How not to repeat the whole code after the try catch loop ?
古いコメントを表示
Hi all
is there a line to indicate the main code between the try catch loop to avoide rewriting it ?
5 件のコメント
What is a try catch loop? try catch means branching in case of errors, but there is no loop. What is "the main code" and what might "between the loop" mean? For "between" there need to be at least 2 limits, but "between the loop" is only one.
"Between the bag there sat a man."
Please post some code, which demonstrates, what you are asking for. Prefer to edit the question instead of adding this information in a comment.
farzad
2019 年 6 月 27 日
Jan
2019 年 6 月 27 日
What does "how the structure is suggested" mean? If you are interested in assistance to solve your problem, it is useful to answer the questions for clarifications.
farzad
2019 年 6 月 28 日
Jan
2019 年 6 月 28 日
@farzad: You can be more clear: Simply explain, which problem you want to solve.
In this code:
for j = 1:10
try
... your code...
catch
warning('found error in %dth file', j);
continue
end
end
you do not have to write any code twice. The first comment (green line) is a placeholder for your code, and the second comment is some other code, which is executed only, if the first one ran without an error. An alternative version of the above code:
for j = 1:10
try
... your code...
... your code, if the above statement succeed
catch
warning('found error in %dth file', j);
end
end
So do you see now, that you do not write anything twice here?
You still did not mention, which problem you want to solve and you assume that anything must be written twice. My questions for clarifications are not answered yet.
You are not a newcomer in this forum, but please let me ask you to read this again: How to ask a good question
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Profile and Improve Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!