フィルターのクリア

how to choose the 1st popupmenu option without having to pick it

2 ビュー (過去 30 日間)
Inês Mendes
Inês Mendes 2015 年 6 月 3 日
回答済み: Walter Roberson 2015 年 6 月 3 日
Hi guys,
I have a popup menu with several options. I want the gui to assume the first option without having to choose it. like when i initialize the gui and i want to analyse the first option, i want to not have to pick it..
i tried defining the popupmenu variables in the opening function but the gui doesn´t recognize other variables defined within that popupmenu if i don´t pick the option..
i don´t know if i was clear enough but if somebody could help i would be much appreciated!
Inês

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 6 月 3 日
You can have it positioned over the first option by setting the uicontrol Value parameter to 1.
If you also want it to take the action that would be done when the first entry is chosen, you have to call the callback yourself, such as
handles = guidata(gcf);
popup = handles.popup1; %use formal name of popup after "handles"
cb = get(popup, 'Callback');
set(popup, 'Value', 1); %choose first option
feval(cb, popup, []); %execute the popup passing the object and an empty event

カテゴリ

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