How do I pass Simulink variables from the “Configuration Parameters” to a GUI created using GUIDE?
이전 댓글 표시
I have a GUI created in GUIDE that: 1. Selects a test data CSV file to be simulated from my directory and 2. Allows the user to press “Start” to begin Simulink simulation. The GUI is communicating with Simulink. The Simulink model has a Stateflow model included that is used for trouble shooting control logic. The GUI is implemented to allow someone not familiar with the design of the Simulink/Stateflow model to be able to trouble shoot any test data CSV file easily.
The problem I am having errors with is when pressing the pushbutton “start” in the GUI.fig that is associated with starting the Simulink model. In my GUI.m file for the “start” pushbutton function, I have “sim SimulinkModel” and than also call some plots that compare test data with simulated data. The errors come from the plots, where variables cannot be found, “??? Undefined function or variable 'sim_time'. “.
These variables are defined in the Simulink “Configuration Parameters”, accessed by pressing Ctrl+E while viewing the Simulink model. I am saving, “Save to Workplace”, these variables, i.e. “Time”, “Output”. How do I pass these variables from the Simulink model to the GUI so when I execute the GUI pushbutton “start” I can get the simulation to work? Note, the Simulink simulation works without any error when pressing “Start simulation” from Simulink.
I believe this is something that needs to be added to the GUI.m file for the pushbutton function.
Thank you for the help.
채택된 답변
추가 답변 (1개)
Babak
2012년 11월 28일
Look up
slConfigUIGetVal
in MATLAB help.
카테고리
도움말 센터 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!