Can I run 2 versions of a function in 2 different Matlab sessions?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Andreas Goser
le 17 Fév 2014
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?
Réponse acceptée
Iain
le 17 Fév 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!