automatize try catch for figures
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Priysha Aggarwal
2019-6-6
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!