How to call simulink parameter into a GUI ?
Show older comments
I have created a GUI, through which I'm running the simulink model. Whenever i want to change the parameter i have to go back to simulink model and change the parameters. Now i want to know if there is any possible way to call or define the parameters directly in the GUI which i created ( like writing some callback function or somthing).
Can someone explain me how it is done.
Answers (1)
ES
on 4 Nov 2013
Suppose you have a constant block in your simulink model, and you have an edit box and push button in your gui.
you put some value in the editbox and press the button. So that the constant block is assigned to the value in the edit box.
To do that, in the callback of the pushbutton
Value_1=str2num(get(handles.editbox,'string'));
set_param(blockname,'value',Value_1);
set_param supports setting of all parameters of a block/model.
3 Comments
Reaper
on 4 Nov 2013
ES
on 4 Nov 2013
Oh okay. to set any property of a block you must know these, 1) which block you want to set the property to(say untitled/subsystem/constant1), 2) what is the property you want to set (say value) 3) what value you want to set (say value =15) 4) on what event you want to set (say press of a push button)
once you gather all the four information(by reading values from your GUI, or based on some internal logic etc), you just call ste_param command at location (4) for setting property(2) of block (1) to value(3).
Reaper
on 5 Nov 2013
Categories
Find more on Simulink Environment Customization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!