
368
Modeling with Simulink
Excerpts from the M-file of the GUI:
gui1.m
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% Hints: get(hObject,‘String’) returns contents of
% edit1 as text str2double(get(hObject,‘String’))
% returns contents of edit1 as a double
%*****************************************
handles.R = str2double(get(handles.edit1,‘String’));
% get the value of R from the editable text box
% and store it in the corresponding field of the
% structure ‘handles’
set(handles.text1,‘String’,[‘R=’num2str(handles.R)]);
% display the value of R using the static text
Figure 12.42 M-file editor showing ...