Catching any type of error in Simulink model

조회 수: 1 (최근 30일)
Vahid Ghorbanian
Vahid Ghorbanian 2015년 7월 19일
댓글: Walter Roberson 2015년 7월 20일
Hello
I am going to use:
try
routine1;
sim('*.mdl');
catch ME
whatever the error in Simulink is!
end.
to run a Simulink model whose parameters might be changed and catch any type of error which might occur in Simulink model not in routine1. But, it is not important what type of error occurs in Simulink model. On the other hand, I do not want to write all of the error identifiers (For example: 'Simulink:Parameters:BlkParamUndefined') one by one in 'catch' section to check if they occur or not. I am looking for a code which can catch all the possible errors in Simulink model without exactly defining type of identifier one by one.
Regards,
Vahid

답변 (1개)

Walter Roberson
Walter Roberson 2015년 7월 20일
The syntax you propose will already catch all errors that can be caught, no matter what their identifier.
  댓글 수: 2
Vahid Ghorbanian
Vahid Ghorbanian 2015년 7월 20일
walter
Thanks for the response. I know that. The point is there might be errors from routine1, not Simulink. I would like to discriminate between the errors returned by Simulink and routine1
Walter Roberson
Walter Roberson 2015년 7월 20일
try
routine1;
try
sim('*.mdl');
catch ME
whatever the error in Simulink is!
end
catch ME
whatever the error in routine1 is!
end

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

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by