MATLAB: Traping Error user input

user

n=inputdlg('Please input a number more than or equal one:')
I would like to trap the user if they input anything other than numbers more than 1. I have tried loop,isnumeric but they all don't work overally.
Any ideas?
Thank you

Best Answer

Is this what you want?
n=inputdlg('Please input a number more than or equal one:')
while isempty(str2num(n{1})) || str2num(n{1})<1
n=inputdlg('Please input a number more than or equal one:')
end
Related Question