MATLAB Answers

Is there a way to check the data being sent to workspace from my Simulink model so I can choose to stop the simulation?

1 view (last 30 days)
Alison Goldsmith
Alison Goldsmith on 8 Jul 2019
Answered: Chidvi Modala on 17 Jul 2019
I have a Simulink Multibody model that outputs position data to the workspace after it is done simulating. I have been running the simulation using the sim() command in a MATLAB script. Is there a way that I can run the simulation in MATLAB while checking the position output and then stop the simulation after I have reached a certain position? Thank you.

  1 Comment

Alison Goldsmith
Alison Goldsmith on 8 Jul 2019
Instead of checking outputs in the workspace I used a switch in my simulink model to stop the simulation when a certain threshold was reached.

Sign in to comment.

Answers (1)

Chidvi Modala
Chidvi Modala on 17 Jul 2019
I understand that you want to stop Simulink simulation when a certain condition is met.
Use the Stop Simulation block with an appropriate logical input to the block.
Alternately you can use Assertion block to halt the simulation and display an error message.


Sign in to comment.

Sign in to answer this question.

Translated by