Initiating a shell command and waiting for the background child tasks to finish before resuming the matlab code.
2 ビュー (過去 30 日間)
古いコメントを表示
I'm using shell command system('some-long-running-command &') for running multiple files in background of linux system. However, I am interested to continues my matlab code when all of them are finished. I am using system('wait') but it is not working. I'd really appreciate your response.
0 件のコメント
回答 (1 件)
Shivam
2023 年 7 月 4 日
If you are using & after command I assume this command will not be finished ( until you dont forcefully do that ) , so you want matlab code to be executed after some desired operations (after which you want to execute your matlab code) of that command got finished.
One way is to redirect the output of command to some file and then parse the output and compare with some string which indicates the completion of the operation
Another way is to use expect script ( reference - https://stackoverflow.com/questions/17916201/background-spawned-process-in-expect)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!