How to run simulink model from a function file?

2 visualizaciones (últimos 30 días)
Vishisht Bhaiya
Vishisht Bhaiya el 4 de Nov. de 2015
Comentada: Vishisht Bhaiya el 5 de Nov. de 2015
Dear Researchers, I am running a function file to determinate some parameters to be used in a simulink model. Before the end of the function I am running my simulink using simout command. At this step all the parameters are deleted and simulink model is not running. In debugging,parameters are normally stored in a workplace until the the last line before the sim command. Why simOut command is deleting the previous results and how to fix it?

Respuestas (1)

Stefan Raab
Stefan Raab el 4 de Nov. de 2015
Hello, you have to specify which workspace the simulation should use. The default value is your base workspace, which is different from your function workspace. Try calling the simulation by:
simOut = sim('YOUR_MODEL','SrcWorkspace','current');
Kind regards, Stefan

Categorías

Más información sobre Simulink Functions 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!

Translated by