From: Will on 5 Nov 2009 06:10 Hi, I have a MATLAB program that calls a Simulink model. However, under certain conditions the Simulink model encounters a NaN value and cannot continue. This causes my whole m-file program to exit. Does anyone know a way that if the Simulink model encounters a NaN and exits, the MATLAB routine can ignore this and continue with what it is doing. ie. some sort of error handling. Any ideas? Thanks, Will.
From: Steven Lord on 5 Nov 2009 09:24 "Will " <w.bradley(a)bradford.ac.uk> wrote in message news:hcubqc$1jq$1(a)fred.mathworks.com... > Hi, > > I have a MATLAB program that calls a Simulink model. However, under > certain conditions the Simulink model encounters a NaN value and cannot > continue. This causes my whole m-file program to exit. > > Does anyone know a way that if the Simulink model encounters a NaN and > exits, the MATLAB routine can ignore this and continue with what it is > doing. ie. some sort of error handling. Assuming that you are aware _why_ the Simulink model is encountering a NaN and are okay with it doing so, try using a TRY/CATCH block. Check inside the CATCH section of the block what error has been thrown (using the error identifier) -- if it's the one corresponding to the Simulink model encountering a NaN, continue on, if not RETHROW it. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: Effect of periodic nonuniform sampling of data to FFT Next: QNX AND SIMULINK |