sampledistPrev .
openingFcn GUI , :
handles.sampledistPrev = 10; %
%
%
set(handles.sampledist,'String',num2str(handles.sampledistPrev));
%
guidata(hObject,handles)
:
function sampledist_Callback(hObject, eventdata, handles)
% hObject handle to sampledist (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of sampledist as text
% str2double(get(hObject,'String')) returns contents of sampledist as a double
input = str2double(get(hObject,'String'));
if(input < 0 || input > 500)
errordlg('Sampled Dist. must be > 0 and < 500','Sample Dist - Input Error');
set(handles.sampledist,'String',num2str(handles.sampledistPrev)); %reset value be the previous entry!
guidata(hObject,handles); %
%
%
else
set(handles.sampledist,'String',['',input]);
%
handles.sampledistPrev = input;
guidata(hObject,handles);
end