Actually I was asking for block in Simulink, not MatLab code.
I'll try to be more specific:
I need to stop a simulation either when it finishes (obviously) or when a signal exceeds a certain value (for which I use a RELATIONAL OPERATOR block and a STOP block). It would be helpful to show a message if the simulation has stopped because of that value exceeding the limit imposed. (This model is going to be used by people when I'm not working here anymore so I won't be able to explain them.)
My question is if there is such a block in Simulink that when that condition is satisfied, a window or some kind of message pops up saying why the simulation has stopped. I would put this block parallel to the STOP block.
Would you GregLocock (or anybody else) be able to help again? Thank you.
...and please, don't be misrespectful.
Cheers