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.

답변 (1개)

ES
ES 2013년 11월 4일

0 개 추천

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

Reaper
Reaper 2013년 11월 4일
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.
ES
ES 2013년 11월 4일
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
Reaper 2013년 11월 5일
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?

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

카테고리

도움말 센터File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

질문:

2013년 11월 4일

댓글:

2013년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by