MATLAB: How to set multiple conditions in if statement in gui

if statementMATLABmatlab gui

I created simple gui. I tagged edit texts with aa and bb. And I want to load error if aa<0 and if bb=0, How to set these two conditions in one if statements. I try to do it this way but part after AND become blue and it doesnt work.
if aa<0 AND handles.bb==0
errordlg('Input must be a diferent!', 'Error')
end

Best Answer

It is hard to guess, what "aa" and "bb" is in your code. Perhaps you mean:
if and(aa < 0, handles.bb == 0)
Or equivalently:
if aa < 0 && handles.bb == 0
The sentence "I tagged edit texts with aa and bb" might point to another problem. What is the contents of "aa" and "handles.bb"? Maybe you need this at first:
aa = str2num(get(handles.aa, 'String'))
bb = str2num(get(handles.bb, 'String'))
Related Question