From: Kwok on
I am a new user for using Matlab simulink and Graphical User Interface. I have a problem about linking the value in GUI into simulink model.
I need set the value of gain inside the simulink model. However, it will show that there is no gain parameter inside the simulink model, is there any problem on it?
This is the code which I refer to the example in the help menu.

function model_open(handles)
% Make sure the diagram is still open
if isempty(find_system('Name','fuzzycons')), open_system('fuzzycons');

figure(handles.figure1)

set_param('fuzzycons/G1','Gain',get(handles.G1,'String'))
set_param('fuzzycons/R1','Gain',get(handles.R1,'String'))
set_param('fuzzycons/Y1','Gain',get(handles.Y1,'String'))
set_param('fuzzycons/G2','Gain',get(handles.G2,'String'))
set_param('fuzzycons/R1','Gain',get(handles.R2,'String'))
set_param('fuzzycons/Y2','Gain',get(handles.Y2,'String'))
set_param('fuzzycons/G3','Gain',get(handles.G3,'String'))
set_param('fuzzycons/R3','Gain',get(handles.R3,'String'))
set_param('fuzzycons/Y3','Gain',get(handles.Y3,'String'))
set_param('fuzzycons/G4','Gain',get(handles.G4,'String'))
set_param('fuzzycons/R4','Gain',get(handles.R4,'String'))
set_param('fuzzycons/Y4','Gain',get(handles.Y4,'String'))
end
%endfunction model_open

I will appreciate it for your help.