Can I run 2 versions of a function in 2 different Matlab sessions?
3 次查看(过去 30 天)
显示 更早的评论
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?
2 个评论
Andreas Goser
2014-2-17
This is technically interesting and I also have a "believe", but I am hesitant to answer because I would not rely on this behaviour continues to be the same for the future. So if this is just curiosity - why don't you try? If it is for a serious application - I am sure there is a better way and wonder which problem you want to solve with this approach?
采纳的回答
Iain
2014-2-17
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!