global variable in a S-function

4 visualizaciones (últimos 30 días)
Gustavo
Gustavo el 24 de Abr. de 2012
Hi everyone
I'm simulating an partial differential equation (PDE) using the S-function block. When i use numbers in the mask parameters the model work well, but I want to use a global variable from other file to put in the mask parameters and occurs an error. I saw that I can only put numbers in the mask parameters, but I have a time variant parameter. How I can put an value from workspace or a variable with a number in the mask parameter from s-function?
best regards,
Gustavo

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 25 de Abr. de 2012
From your description, this seems like the supported workflow. Please specify the error message that you see? Also, please ensure that if you want to tune that parameter (ie, it is time-variant), please ensure that your S-function declares the parameter as tunable using ssSetSFcnParamTunable.
One other thing is that you need to run Ctrl+D or set_param(model, 'SimulationCommand', 'update') every time tunable parameters change in the workspace in order for Simulink to pick up the new value.

Gustavo
Gustavo el 25 de Abr. de 2012
I found the error. :)
I had not declared the variables in the .m s-function.
thx.

Categorías

Más información sobre Block and Blockset Authoring 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