MATLAB: How to perform post simulation analysis in App Design of a Simulink Simulation

simulink

How do I perform post simulation analysis in App Design of a Simulink Simulation? I have a function, "PostSimActions" that I would like to call. However, I only want to call this once the simulation is completed.

Best Answer

Use the "get_param" command to check and see if the simulation is finished. The code below will check once a second to see if the simulation is completed. If it is, PostSimActions is called.
k = get_param(gcs, 'SimulationStatus');
while k == 'running'
k = get_param(gcs, 'SimulationStatus');
pause(1)
end
PostSimActions(app);