How to execute an .m file from the command line in windows without opening a new matlab copy
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shizuka
el 4 de Mzo. de 2013
Comentada: Walter Roberson
el 6 de Mayo de 2020
The problem is, I want to execute a certain .m file from the command line. I know how to do already:
matlab -nosplash -r "run whathever.m"
Problem is, this opens a new instance of Matlab, I don't want that, I want it to simply use the already open instance of Matlab. Is there any way of doing that?
3 comentarios
Matt Merkley
el 5 de Mayo de 2020
You can add -nodesktop to your call.
matlab -nosplash -nodesktop -r "whathever"
Walter Roberson
el 6 de Mayo de 2020
Using -nodesktop can prevent a new graphical interface from starting up, but this is not quite the same as using an existing MATLAB instance. In particular, if you used an existing MATLAB instance, you would have access to the state of that instance, such as the contents of the base workspace and global workspace. In theory one could even wish to run a command line that affected the graphics of an existing session.
Respuesta aceptada
Kaustubha Govind
el 5 de Mzo. de 2013
I think you need to write code to call into MATLAB as a COM Server. You will also need to ensure that your currently running MATLAB session has been enabled to run as a COM Server. The instructions here should help with that.
0 comentarios
Más respuestas (1)
Shizuka
el 7 de Mzo. de 2013
2 comentarios
Kaustubha Govind
el 7 de Mzo. de 2013
Shizuka: Sorry, that's the only way that I can think of. Perhaps you need to have admin privileges when you attempt to start MATLAB as a COM Server?
Ver también
Categorías
Más información sobre Write COM Applications to Work with MATLAB en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!