フィルターのクリア

How to run multiple Matlab codes one after other even if one middle code will stop due to error?

4 ビュー (過去 30 日間)
Suppose I have 5 codes "1.m", "2.m" ,"3.m" ,"4.m" and "5.m". the code "3.m" has an error due to which it won't run. I want to run the codes one after other in the above order. if in between "3m" won't run other codes "4.m" and "5.m" should run. How i will achieve it?
  2 件のコメント
Stephen23
Stephen23 2023 年 4 月 2 日
編集済み: Stephen23 2023 年 4 月 2 日
Note that "1.m", "2.m" ,"3.m" ,"4.m" and "5.m" are not valid function or script names.
Niranjan Borah
Niranjan Borah 2023 年 4 月 5 日
Thank you very much. It helps a lot.

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

回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2023 年 4 月 2 日
You can try something like this:
n_p = 5;
run_status = zeros(n_p,1);
try
one
run_status(1) = 1;
catch
run_status(1) = 0;
prog_msg{1} = lasterr;
end
try
two
run_status(2) = 1;
catch
run_status(2) = 0;
prog_msg{2} = lasterr;
end
% etc
HTH

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by