How to call simulink parameter into a GUI ?

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)

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

Hey,
Thanks a lot, But the problem is . I'm not using GUIDE whereas i have built or in other words i have programmed my own GUI on a matlab script using callback functions and when u run the program the output would be a screen which has multiple options through which i can run the model which is in simulink and also view the results on the same screen. Basicly its completely new GUI but not the GUIDE where i can put the block name and set the param.
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).
Thanks, it helps me to set my thoughts correct.
Is there any in detail example, which can show how to connect the block parameters to the GUI?

Sign in to comment.

Categories

Asked:

on 4 Nov 2013

Commented:

on 5 Nov 2013

Community Treasure Hunt

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

Start Hunting!