필터 지우기
필터 지우기

how i have reaction against error received of matlab?

조회 수: 2 (최근 30일)
xosro
xosro 2015년 7월 14일
편집: Walter Roberson 2015년 7월 18일
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