フィルターのクリア

How do i open and close a panel with a pushbutton in matlab GUI guide?

11 ビュー (過去 30 日間)
Giri
Giri 2018 年 4 月 13 日
コメント済み: Giri 2018 年 4 月 16 日
I have a pushbutton in my Matlab GUI and if i press the pushbutton at the start a panel drops down. Now what i want is,when i press the button again,the panel should close.
So summarising: Press the button the first time -panel opens Press the button the second time -panel closes an how do i know the button is getting pressed so that i can set the condtions?
Kindly help me with this.I am new to matlab GUIDE.Any help will be appreciated
  2 件のコメント
Geoff Hayes
Geoff Hayes 2018 年 4 月 13 日
Giri - are you showing the panel (i.e. setting its visibility to true) when you press the button the first time? Do you want to hide (set its visibility to false) your panel when you press the button again? Is your panel another GUI? Please copy and paste some of your code (here to this ticket) so that we can get an idea what you have implemented so far.
Giri
Giri 2018 年 4 月 16 日
Yes,you understood it right.I am setting the visibility to true the first time and then i want to set it to 'off' when i press the button again. No its not a second GUI .its the same GUI.

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

採用された回答

Geoff Hayes
Geoff Hayes 2018 年 4 月 16 日

Giri - in the push button callback, check the visibility state of the panel. If it is OFF, then show the panel. And if it is ON, then hide it. For example, the code in GUIDE may look like

function pushbutton1_Callback(hObject, eventdata, handles)
if strcmpi(get(handles.uipanel1, 'Visible'), 'on')
    set(handles.uipanel1, 'Visible', 'off');
else
    set(handles.uipanel1, 'Visible', 'on');
end
  1 件のコメント
Giri
Giri 2018 年 4 月 16 日
Thank you so much...it worked perfectly

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

その他の回答 (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