Edit box - Want an error message when a negative value is entered (Beginner)
Mostrar comentarios más antiguos
Can anyone explain to me why this is not working for me. There are no error messages - it just doesn't give me any error box.
function edit1_Callback(hObject, eventdata, handles)
function edit1_CreateFcn(hObject, eventdata, handles)
strng=get(gcbo,'string');
if ~isempty(strng)
val=str2num(strng);
if val < 0
errordlg('Value cannot be negative','Error','modal');
set(gcbo,'string','Try again');
end
end
Respuestas (1)
Mathew
el 6 de Mzo. de 2012
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!