Displaying an error message a non-numerical input is inputted in GUI
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Scope Variables and Generate Names 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!