I want to catch all warnings issued during the simulation of a Matlab/Simulink model. The result of simulation should be an array of warnings, as there might be more than one warning.
The ideal code would look something like this (except that catch does not work with warnings):
try
sim('myModel');
catch warnings
for i=1:length(warnings)
<process each warning>
end
end
Things I've tried already without success:
- Turning the warnings into exceptions won't help, as I will only get the first warning and not all of them.
- Overriding the built-in warning function with my own "@char\warnings.m" will only catch the warnings in my own script but not in the sim-function.
lastwarn
will give me only the last warning message, not all of them.
P.S.: I'm using Matlab 2010b on Windows.