How to start Matlab from command prompt and wait for the application to return

13 visualizaciones (últimos 30 días)
I'm trying to run some memory analysis tool to debug a MEX file and detect possible heap corruption.
I need to start Matlab from this tool, and type the script commands corrupting the memory. It is not possible to attach to an existing process since the tool need to know the original application state.
The issue is that matlab.exe creates a new process and return immediately. So the analysis is complete before it can even start.
How can I make matlab.exe return when matlab is closed?

Respuesta aceptada

Damien LEFEVRE
Damien LEFEVRE el 18 de En. de 2017
Matlab actually has a command line option -wait that does the trick.
matlab.exe -wait
Or with running scripts automatically as Jan Simon suggested
matlab.exe -wait /r "C:\MFiles\YourScript"

Más respuestas (1)

Jan
Jan el 18 de En. de 2017
I'm not sure what you want to do and why Matlab "returns" immediately.
Perhaps it helps to start the script automatically:
matlab.exe /r "C:\MFiles\YourScript"
This starts the geiven script on startup of Matlab. If you want to close the Matlab session automatically afterwards, append a "quit" to teh end of YourScript.m.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by