Effacer les filtres
Effacer les filtres

No Simulation Output when Simulations runs from a MATLAB script

24 vues (au cours des 30 derniers jours)
Thomas Fischer
Thomas Fischer le 2 Juin 2023
Hi everyone,
I am currently running a Simulink simulation that encounters difficulties in solving certain states, resulting in errors. In order to address this issue, I would like to examine some data prior to the occurrence of the error and remove specific input parameters to allow the simulation to complete without errors. This should happen automatically by running MATLAB script. However, when I run my script and the simulation encounters an error, the simulation does not finish and I do not obtain any simulation output in my workspace. This output is crucial for me to modify the input data.
Interestingly, when I run the simulation directly from Simulink, the output data appears in the workspace as expected even with the error present. My challenge is to find a way to retrieve the simulation output data into my workspace from the MATLAB script, even if the simulation does not finish.
I would greatly appreciate any insights or suggestions on how to overcome this issue.
  1 commentaire
Christian
Christian le 21 Juil 2023
I have the exact same issue and I am looking for a solution. sim does not behave like clicking on the run button. The run button always produces output. sim only produces output when the simulation finishes.

Connectez-vous pour commenter.

Réponses (2)

Andreas Goser
Andreas Goser le 2 Juin 2023
My first thought is about the fundamental issue with your simulation. Assuming you have a somewhat recent release, there a many ways to debug your simulation. I mainly think about the "Step forward" functionality and you can simply select a signal to see the value.
About the behaviour running the simulation from a script: Please verify if it is not a function. If it is a function, all variables are in the function workspace, not the base workspace.

Simon
Simon le 7 Sep 2023
Had the same issue.
Called the Simulation with sim(modelname, 'StopTime','SimuTime');
Found the Output data in the var ans instead of the var out.
If you need it a specific name for the out put simply call
testout = sim(modelname, 'StopTime','SimuTime');

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by