Catching any type of error in Simulink model
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Walter Roberson
2015-7-20
The syntax you propose will already catch all errors that can be caught, no matter what their identifier.
2 个评论
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 Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!