필터 지우기
필터 지우기

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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by