Filter löschen
Filter löschen

If statement error code mistake - string input too long not working...

1 Ansicht (letzte 30 Tage)
Muaaman
Muaaman am 17 Dez. 2014
Bearbeitet: per isakson am 18 Dez. 2014
I essentially have this as code in the GUIDE GUI pushbutton1_Callback. Error Code II is not working properly. Even if I enter in say "Bob" in the empty textbox and push the button, its giving me Error Code II (the elseif statement). What's the issue here? Input would be greatly appreciated.
if isempty(editString)
errordlg('Please enter a name into the text-box. ...','ErrorCode I');
return
elseif char(editString) > 12
errordlg('Please enter a name with less than 12 characters. ', ...
'Error Code II');
else
delete(gcf)
gui_02
end

Antworten (1)

per isakson
per isakson am 18 Dez. 2014
Bearbeitet: per isakson am 18 Dez. 2014
elseif char(editString) > 12
I guess your intention is
elseif length(editString) > 12

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by