Can I run 2 versions of a function in 2 different Matlab sessions?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Andreas Goser
el 17 de Feb. de 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?
Respuesta aceptada
Iain
el 17 de Feb. de 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.
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!