Why does my function freeze or hang when I use the bang or exclamation point operator (!) or DOS to invoke a separate process from MATLAB?

1 view (last 30 days)
Why does my function freeze or hang when I use the bang or exclamation point operator (!) or DOS to invoke a separate process from MATLAB?
When the spawned process or application exits, MATLAB continues to work correctly however MATLAB hangs until the application exits. I observe the same behavior if I compile my function using the MATLAB Compiler.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
In general, spawning a separate process should hang MATLAB until the application exits. Some applications automatically background or are automatically backgrounded by the application that spawned them.
The solution to this is to background the spawned application. This may be accomplished by using the DOS application start.exe.
Add the command "start" to the beginning of your DOS call as in:
!start notepad
or
dos('start notepad')

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!