How to get used Matlab Workspace variables within Simulink model

조회 수: 7 (최근 30일)
Nikolay
Nikolay 2019년 5월 23일
댓글: Fangjun Jiang 2019년 5월 31일
Hi there, I have a huge model as legacy knowledge. The model uses about 150 WS variables, but the ini scripts are delivering more than 300. Is there an automatic way to sort out which WS variables the model uses?
Thanks
Nikolay
  댓글 수: 2
Santosh Gnanasekaran
Santosh Gnanasekaran 2019년 5월 23일
If you have followed a specific pattern of names for parameters, then you can write a script to search and extract all the parameters from the model and then compare it with ini scripts.
Nikolay
Nikolay 2019년 5월 23일
Unfortunately I don't have such a pattern. I'm just wondering, when I hit Ctrl+D to update my diagramm it looks for the parameters and gives a message when some are missing. Is there any way to get the informationabout the parameters Simulink is saerching for in the Matlab WS?

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

채택된 답변

Nikolay
Nikolay 2019년 5월 31일
I found the way, it was very simple and implemented in Simulink out of the box:
Just right click on the subystem from which down you want to have the list of the used variables and select "Find Referenced Variables". The model must be initialized befor, otherwise Simulink will ask you to do so. A list with all used variables will appear in the Model Explorer.
In addition you can go to the BaseWorkspace (Model Explorer) and see all not used variables by opening the content menu with right click and selecting 'Find Unused Variables'

추가 답변 (1개)

Fangjun Jiang
Fangjun Jiang 2019년 5월 23일
Simulink Data Dictionary has the capability. You can migrate your workspace variables to a Simulink Data Dictionary. When you do the migration, it only migrates the variables that are used by the model. It will ask you whenther to clear those variables (that has been migrated to a SLDD) from the workspace. If you answer "Yes", then you will be left with a list of variables in the workspace that are not used by the model.
In your Simulink model, click File, Model Properties, Link to Data Dictionary,

카테고리

Help CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by