Can I run 2 versions of a function in 2 different Matlab sessions?
5 views (last 30 days)
I am wondering if it is possible to run 2 versions of the same function in 2 different Matlab sessions.
- Let's say I have a function named myFunction.m, and I start a Matlab session ("Session 1") and run a script which calls myFunction many times over its 2-hour run time. Let's call this version of myFunction.m "Version 1".
- While session 1 is running the script, I edit myFunction (call this "Version 2"). I save myFunction with the original name and in the original location.
- I then open another Matlab session ("Session 2"), and run the script which calls myFunction many times.
I believe Session 1 will continue to run Version 1 of myFunction, while Session 2 will run Version 2 of myFunction. Is that correct?
Iain on 17 Feb 2014
You most certainly can run Version 1 of function "blah" in one instance of matlab, update blah to version 2, open up a second instance of matlab, and run the function.
Why wouldn't you just use a different function name for version 2 though? Its less prone to things going wrong.