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

조회 수: 30 (최근 30일)
Mats
Mats 2015년 4월 28일
댓글: Ryan Livingston 2015년 6월 2일
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?

답변 (1개)

Sainath Varikuti
Sainath Varikuti 2015년 4월 29일
편집: Sainath Varikuti 2015년 4월 29일
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
Sebastian Castro
Sebastian Castro 2015년 5월 15일
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 2015년 6월 2일
Documentation for Sebastian's comment is here. See the section Setting Data Scope for how to change the scope to a parameter.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by