フィルターのクリア

Error dialog box for push button when empty textbox; GUI

3 ビュー (過去 30 日間)
Muaaman
Muaaman 2014 年 12 月 15 日
コメント済み: Adam 2014 年 12 月 15 日
I have a GUI where the user would input their name, then press a button to proceed to the next GUI.
I want to make it so that if they leave the textbox blank and try to proceed by pressing the OK push button, they get an error dialog message prompting them to enter a name. It does not seem to work here. How would I accomplish this? Input is much appreciated.
The first line of the function is from the GUIDE output for .m file figure formation (as usual).
function pushbutton1_Callback(hObject, eventdata, handles)
editString = get(handles.edit1, 'String');
if editString == ''; % Enter in blank?
errordlg('Please enter a name into the text-box. We thank you in anticipation.','Error Code I');
else
gui2
close gui1
end

採用された回答

Stalin Samuel
Stalin Samuel 2014 年 12 月 15 日
use if isempty(editString )
  7 件のコメント
Muaaman
Muaaman 2014 年 12 月 15 日
編集済み: Muaaman 2014 年 12 月 15 日
My apologies, I meant to accept your answer (Adam) but it did not give me an option. However, I appreciate the input from both Stalin and Adam.
Adam
Adam 2014 年 12 月 15 日
I added mine to stalin samuel's answer since it was just an extension of his correct input.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by