How to store Appdesigner parameters in MATLAB workspace?

조회 수: 1 (최근 30일)
Farzam Malmir
Farzam Malmir 2018년 4월 9일
편집: Farzam Malmir 2018년 5월 29일
Hi,
I have a Simulink model of a car and need to design a GUI in order for the users to change the desired parameters such as drive cycle. I want the users to have as low interaction as possible with the Simulink model. I have already designed the GUI but there is still a major problem remains unsolved.
I have to first manually run the initialization m file in order to have all the required initial parameters in workspace (which are necessary to run the Simulink model). When running the initialization file from Appdesigner, it seems it stores the loaded data and doesn't load anything into workspace (While I need to have data in workspace). This is a very major problem because it doesn't make sense that the user first run the file in MATLAB and then return to the Appdesigner. (It's somehow weird and pointless)
I would be grateful if anyone who has experienced a similar problem before or has any idea of solving this issue, help me on this matter.
Note that I found this thread and tried to use assignin and export2wsdlg commands, but I got error. Please also let me know how I can use them. I'm probably missing something.
Thanks in advance.

채택된 답변

Birdman
Birdman 2018년 4월 10일
편집: Birdman 2018년 4월 10일
For initializing the parameters, you may use InitFcn in your Simulink model. It is located at File->Model Properties->Model Properties->Callbacks. Once you write your initialization code there, every time your model is opened, the parameters are going to be automatically loaded. Therefore, you won't have to do anything more with your app about initializing the parameters.
  댓글 수: 2
Farzam Malmir
Farzam Malmir 2018년 5월 14일
Thank you so much. The problem solved by initializing the Simulink model using a callback function.
Birdman
Birdman 2018년 5월 14일
Ok, you can accept the answer if it helped.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by