if的問題,判斷未通過可是沒出現msgbox
設一個edit用if判斷輸入有沒有錯誤
a=get(handles.edit1,'string')
b='b'
if a==b
hmb=msgbox('答對了!!!','正確','warn')
else
hmb=msgbox('答錯囉,請檢查','錯誤','warn')
end
如果edit裡面輸入的字超過設定的數字的話,比如說上面程式的a=bb(正確是b)
出現下面的:
??? Error using ==> eq
Matrix dimensions must agree.
Error in ==> gui>pushbutton1_Callback at 107
if a==b
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> gui20090521 at 42
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.
要怎麼判斷是錯的? 参考下strcmp, strcmpi, strmatch ...
页:
[1]