how i have reaction against error received of matlab?

2 次查看(过去 30 天)
i have a for loop with a condition on receive or not receive a error of matlab program, how i can have this condition?

采纳的回答

Walter Roberson
Walter Roberson 2015-7-15
for variable = first : last
got_error = true;
try
do something risky here
got_error = false; %only gets here if the risky thing worked
catch ME
do something about the error; the details of it are in ME
end
if got_error
we had an error and did something with it but maybe we want to know that later
end
end
  1 个评论
xosro
xosro 2015-7-18
编辑:Walter Roberson 2015-7-18
hi mr roberson
i fix this problem (do something risky here) by
if (strcmp(me.message,'my intended error.'))
do something about the error;
else
rethrow(me);
end
thank you about your perfect comments.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by