Borrar filtros
Borrar filtros

How do I access model workspace variables in simulink/simevents?

14 visualizaciones (últimos 30 días)
Mats
Mats el 28 de Abr. de 2015
Comentada: Ryan Livingston el 2 de Jun. de 2015
I have varying transport times in a discrete events system. I have created a matrix of the times in the model workspace but I cannot find how i access that variable from within the model.
I currently have a Attribute function where I try to access the model workspace. How do I do?

Respuestas (1)

Sainath Varikuti
Sainath Varikuti el 29 de Abr. de 2015
Editada: Sainath Varikuti el 29 de Abr. de 2015
You can view the model workspace variables in Model Explorer or use the methods of Simulink.ModelWorkspace class to operate on model workspace variables.
  3 comentarios
Sebastian Castro
Sebastian Castro el 15 de Mayo de 2015
Why do you need to use get_param and getVariable if the entire model already has access to the model workspace?
Instead, I would suggest you define a "parameter" scoped variable in your MATLAB Function, which will inherit its value from the Model Workspace. To do this, you can use the Model Explorer and navigate to the MATLAB Function block itself to add new data.
Then, you should be able to reference traveltime as you would any other variable.
- Sebastian
Ryan Livingston
Ryan Livingston el 2 de Jun. de 2015
Documentation for Sebastian's comment is here. See the section Setting Data Scope for how to change the scope to a parameter.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by