Reading workspace variable from a .fig file

조회 수: 4 (최근 30일)
Vamsinag Gunti
Vamsinag Gunti 2018년 7월 13일
댓글: Vamsinag Gunti 2018년 7월 16일
Hi,
I am working with an existing simulink model. When this model is opened. The workspace is already loaded with many variables. But I don't seem to find any .mat file associated with this simulink model. I am now writing a UI script and I want to read these variables. Is it possible for me to directly read these variables without the .mat file?
Kindly let me know if more information is necessary. Thanks in advance.
Best Regards, Vamsi

채택된 답변

Christopher Wallace
Christopher Wallace 2018년 7월 13일
Hi Vamsi,
Firstly, yes, you can access workspace variables from within with a GUI. Check out the 'evalin' function. The default workspace is defined as 'base', here's an example of how to use it below:
uiVar = evalin('base', 'workspaceVar')
Secondly, if your curious as to where the variables are coming from when the model is loaded right-click on an empty portion of the Simulink model and then select 'Model Properties'. Under the 'Callbacks' tab I suspect you will find an asterisk symbol next to PreLoadFcn or PostLoadFcn signifying that there is code being run during those events. You should be able to look into that code to figure out where the variable creation is.
&#16
Let me know how it works!
&#16
Best regards,
Chris
  댓글 수: 1
Vamsinag Gunti
Vamsinag Gunti 2018년 7월 16일
Hi Chris,
It worked. Thanks for the Support :)
Best Regards, Vamsi

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by