Output missing when running Simulink model from script.

22 Ansichten (letzte 30 Tage)
Lennart
Lennart am 26 Aug. 2015
Kommentiert: swadexi dx am 28 Feb. 2023
Hey everybody,
I am currently trying to run a automated simulation by running a simulink model from a matlab script. Everything works fine so far except of that the "to workspace" block doesn't return it's output to the matlab workspace when I run the simulink model with the command "sim(modelName, 'StopTime', '100');". When I click the play button of the Simulink model it does return the output to the matlab workspace.
Is there any possibility that I start the simulation from a matlab script and process the output vector right afterwards?
Thanks in advance!
Regards,
Lennart

Antworten (1)

Walter Roberson
Walter Roberson am 26 Aug. 2015
When you use sim(), the To Workspace block writes the data into the workspace of the function that called the sim() command. That function can act on the variables such as by using assignin('base').
When you start a model from a graphics menu, the To Workspace block writes the data into the base workspace.
  6 Kommentare
Walter Roberson
Walter Roberson am 5 Apr. 2021
To Workspace can be configured to either write in the workspace of the calling function (or script) or else into the base workspace. If the expected output does not show up in the workspace of the calling function (or script) then try
evalin('base', 'whos')
to see if it showed up there.
swadexi dx
swadexi dx am 28 Feb. 2023
I have the same issue, the sim() function takes the output of simulink only from the integrator.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interactive Model Editing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by