I have two buttons. When DC_start is pressed it disables itself and two user inputs, and then enters a while loop. At some point the user will click the DC_end button and it changes its value to 1 and the while loop is supposed to break.
A simplified version of the code is provided below with the error. Please let me know how to overcome this as its my first time making a GUI. I believe I have to use the uiwait function and suppress the warning, but even then I am confused at how to use the handle for the DC_end button if its not in the scope of the DC_start callback function.
If there is a completely different but better way to code this up. I'm open to suggestions.
Thanks in advance, George
function DC_start_pushbutton1_Callback(hObject, eventdata, handles)
set(handles.DC_start_pushbutton1,'Enable', 'off')
set(handles.DC_numSamples_edit, 'Enable', 'off')
set(handles.DC_electrodesList_edit, 'Enable', 'off')
channelNum = 0;
dataEntry = 0;
endButton = get(handles.DC_end_pushbutton2,'Value');
while( ~isequal(endButton, 1))
endButton = get(handles.DC_end_pushbutton2,'Value');
channelNum = channelNum + 1; dataEntry = dataEntry + 1;
pause(0.500);
if endButton == 1;
disp('Data collection canceled!')
break;
end
end
disp('Done!');
function DC_end_pushbutton2_Callback(hObject, eventdata, handles)
set(handles.DC_end_pushbutton2,'Value',1)
Error Message:
Undefined function or variable 'ElectrodeGUI'.
Error in
@(hObject,eventdata)ElectrodeGUI('DC_end_pushbutton2_Callback',hObject,eventdata,guidata(hObject))
Error using pause
Error while evaluating UIControl Callback
0 Comments
Sign in to comment.