How can I interact with a Simulink model from an App Designer app or MATLAB function using the 'sim' command?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 31 de Dic. de 2021
Editada: MathWorks Support Team
el 27 de Mayo de 2024
I use the 'sim' command to run a Simulink simulation using MATLAB code. I would like to define inputs and parameters for my model, as well as post-process the simulation output in MATLAB code.
As long as I use a simple MATLAB script, everything works fine, but once I try to do the same from within a MATLAB function or App Designer app, I get errors such as:
Variable 'simin' has been deleted from base workspace.
Unrecognized function or variable 'simout'.
How can I simulate the model in the function workspace?
Respuesta aceptada
MathWorks Support Team
el 24 de Mayo de 2024
Editada: MathWorks Support Team
el 27 de Mayo de 2024
Rather than changing the workspace that Simulink interacts with, the recommended way to apply variable overrides from a function is to use the setVariable() method on SimulationInput objects. The simulation input object provides better containerization, traceability, and reuse across workflows. We recommend adapting your script to use the "SimulationInput" object:
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Verification, Validation, and Test en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!