I have a skript with 50+ figures. If i run the script and there is going somethin wrong with one figure the script will obviously stop.
What i want the programm to do is skip the figure with the error and go to the next one.
Any way to do this without writing 50+ try catch statements?
Thanks in advance!
Chris

답변 (1개)

Priysha Aggarwal
Priysha Aggarwal 2019년 6월 6일

0 개 추천

What you can do is to embed your try catch statemets in a for/while loop.
Try loading each figure in the loop one by one, each embedded in a try catch set. This is the only way to skip writing try catch block for each figure separately.
for i=1:50
try
%load your figures here (one in each iteration)
catch
%you may want to print the caught exception here
end
end

댓글 수: 1

Christian Tieber
Christian Tieber 2019년 6월 7일
편집: Christian Tieber 2019년 6월 7일
sorry if my question is stupid.
but if i want to load a figure i have to create and save it in the first place. right?
i want a try catch statement for the creation of the figure. i dont know how to put this in a loop cause they ways the figures are created is uniqe for every figure so i dont see a way to automatise the figure creation process with a loop.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2019년 6월 5일

편집:

2019년 6월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by