MATLAB: Continue matlab while a dos/system command is executed / close dos window

blocking dosclose windowcontinue matlabdosMATLABsystem

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!

Best Answer

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').