Continue matlab while a dos/system command is executed / close dos window
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have to use a dos-Programm where I don't have the source code. This programm controlls some measurement device via ftp.
To start the programm I call it by
answer = dos(['my_programm.exe', optionsstring])
The programm produces periodic output that is print to the matlab command window.
It runns until it is stopped by calling another exe (which writes something into a file that is read by the first...)
answer = dos(['my_end_programm.exe', optionsstring])
This works fine, if the two dos-comands are executed in a callback of a gui in Matlab2014a! Execution of 'my_programm.exe' does not block matlab. The gui stays aktive and I can press some button that triggers the 'end'-command.
However in matlab 2019b this does not work any more. The dos-command seems to block matlab. matlab waits until 'my_programm.exe' ends - which does not happen.
Also in 2014a when called from a scipt - no gui-callback - matlab gets blocked by the dos command.
Is there a way around this? Preferable in matlab 2019b or 2020?
As a workaround I use the option '&' in 2014:
answer = dos(['my_programm.exe', optionsstring, ' &'])
This opens a dos console window. The output of 'my_programm' gets there - which is aceptabel - but the window stays open. Since I call 'my_programm.exe' a couple of times this gets messy.
How can i close the dos console window?
Thank you for any help!
6 Kommentare
Ameer Hamza
am 14 Mai 2020
Ok. I misunderstood it to be a MATLAB function. Thanks for the information.
Akzeptierte Antwort
Rik
am 14 Mai 2020
Bearbeitet: Rik
am 14 Mai 2020
Try the start command. It will detach and run, so that might run your starter function without opening a new cmd window.
Another possibility would be to have an executable created with bat2exe (google is your friend). Last time I used that it had the option of running without a visible window. That way you can run that executable with system('start wrapperbat.exe').
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Parallel and Cloud finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!