Converting simulink blocks to code for a GUI?
1 view (last 30 days)
Show older comments
I would like to create a GUI in MATLAB that has two sliders that can be used to adjust the value a and b. I know I can get the GUI to open simulink and have simulink do this and then packet the information using UDP as shown in the following image:
However, I would prefer to be able to convert these simulink blocks to code in the GUI slider. More specifically, I am interested in coding the packet output block so the GUI button can send the information. Does anyone know how to do this?
0 Comments
Answers (2)
cr
on 14 May 2013
You can use set command for callbacks of GUI sliders with handles of the constant blocks to change the block parameter values. Not sure what the packet output block is, but if you are able to "send the information" from simulink, then the same can be done via GUI too using handle to the block. For more info, see gcs, gcb, set & get. You may want to read the section on programmatically using simulink models in documentation.
Kaustubha Govind
on 20 May 2013
Since you'd like to execute the GUI as if it were a block, it might be best to create a custom block that opens up and reads from a GUI during simulation, and computes its outputs based on actions on the GUI. Please look into MATAB S-functions.
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!