Displaying an error message a non-numerical input is inputted in GUI
Mostrar comentarios más antiguos
To be more clear, I'm trying to use GUI in MATLAB for a project. In this project I want the user to input numbers, but if they input a character (like 'a' or 'b', or 'djos') I want there to be an error message to pop up.
Currently I am using:
m = get(handles.filter);
if ~ischar(m)
errordlg('ERROR: Input must be numerical.')
end
I've also used commands "error" and "msgbox", as well as "isnumeric" and "isstring" to no avail. I can get the error message to pop up just fine, however it even gives me the error message for fractions or numbers like "1" and "1/4"!
What am I doing wrong?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Scope Variables and Generate Names 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!