MATLAB Answers

Does Matlab system call wait for the operation to finish before continuing with the script?

55 views (last 30 days)
James
James on 28 Mar 2013
I have a script where I am making system calls such as:
cmd = 'tar -xvf filename.tar';
system(cmd);
My question is, once Matlab has started the system call, does it continue on with the Matlab script immediately or does it wait for the system call to finish outside Matlab before continuing on with the script?
Thanks in advance! James

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 28 Mar 2013
It waits for the process. However if the process starts a subprocess and then exits, it will not wait for the subprocess. So if you do not want it to wait, add " &" to the end of the command.
cmd = 'tar -xvf filename.tar &';

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.