MATLAB: How can i keep a matlab funtion running, event though the simulink simulation which is called crashes

callcrashfilem-fileSimscape Multibodysimulink

Hy there!
I'm running a matlab funtion in a m.-file and i'm calling a simulink/simmechanics model there. since i change the parameters of this model in my m.-file, sometimes the model works, and sometimes it crashes.
I'm doing an optimization of my model here, so i simply would like to ignore the ones that crashed, and continue with other parameters, without having to restart my function. What can I do?
Thanks in advance! Best, Dominik

Best Answer

Try using a try/catch block.
Related Question