MATLAB: How to get used Matlab Workspace variables within Simulink model

simulinkworkspace variables extract simulink

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

Best Answer

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'