how to validate edittext to accept only integers between 25 to 100
Show older comments
hi everyone... im trying to validate a edit text field to accept integers between 25 to 100 .i have written the following code but im not getting the result.....
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
num=Str2double(get(handles.edit1, 'String'));
if num<=25 && num>=100
warndlg('invalid age');
end
please suggest if any changes are to be made in the code..anykind of help will be appreciated..
Accepted Answer
More Answers (1)
Sean de Wolski
on 13 Mar 2018
1 vote
Use appdesigner and the numeric edit field with upper and lower limits.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!