Displaying an error message a non-numerical input is inputted in GUI
이전 댓글 표시
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?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!