Is there any way of executing multiple DOS commands in one run?

10 ビュー (過去 30 日間)
Ravindu Lokuliyana
Ravindu Lokuliyana 2018 年 12 月 3 日
コメント済み: Voss 2022 年 3 月 2 日
Hi there,
I have multiple test cases (e.g. Test01, Test02, Test03...etc ) which need to excute in Windows DOS command prompt using 'swanrun' command. These files are generated from SWAN third generation wave model.
Currently I'm using ' dos [swanrun 'filename'] ' ; (e.g. dos [swanrun Test01]) to take the result outputs. So it will first complete Test01 and then come to Test02 and so on.
Is there any possibility to run these files parallely in matlab?(as we can run these cases using multiple windows command prompts) and in Matlab, is there any facility available to parallel processing?
Thank you

採用された回答

Jan
Jan 2018 年 12 月 3 日
編集済み: Jan 2018 年 12 月 3 日
Append a '&' to the string provided to dos() (or to system(), which does not depend on the platform):
for k = 1:5
filename = sprintf('Test%02d', k);
system(['swanrun ', filename, ' &'])
end
  3 件のコメント
xiaohuo
xiaohuo 2022 年 3 月 2 日
any suggestions for the follwoing code? it does not work.
cmd_H01 = 'H1_L01.exe'; % Path of H1_L01.exe
cmd_H02 = 'H1_L02.exe'; % Path of H1_L02.exe
system('cmd_H01; cmd_H02');
system('cmd_H01 & cmd_H02');
Voss
Voss 2022 年 3 月 2 日
cmd_H01 = 'H1_L01.exe'; % Path of H1_L01.exe
cmd_H02 = 'H1_L02.exe'; % Path of H1_L02.exe
system([cmd_H01 ' & ' cmd_H02]);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrepare and Analyze Model についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by