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
2013년 11월 4일
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
2013년 11월 4일
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
2013년 11월 5일
카테고리
도움말 센터 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!