MATLAB: If statement error in gui.

code errorguiif statement

Hi, I have an input box so that the user would input a number ranging 1 to 300. if he put more than 300 and less than one error pop out. this is my code:
a = (str2num(get(handles.Th,'String'))
if (a < 1 & a >= 300);
warndlg('Pressing OK will clear memory','!! Warning !!')
end

Best Answer

There is no value of "a" which is simultaneously less than 1 and greater than or equal to 300.
if a < 1 | a >= 300 %finds values outside the range [1, 300)
if a > 1 & a <= 300 %finds values inside the range (1, 300]
Related Question