how to do coding on popup menu to display image

2 visualizaciones (últimos 30 días)
haha haha
haha haha el 21 de Abr. de 2015
Respondida: Geoff Hayes el 23 de Abr. de 2015
I have design a GUI, i have about maybe 10 image name to select in the popup menu what code should i use so that the image i select at the popup menu will be call out?

Respuestas (1)

Geoff Hayes
Geoff Hayes el 23 de Abr. de 2015
haha - you will need to access the String and Value properties of the popup menu to get the image name that has been selected. Your popup menu callback would looks something like
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% get the cell array of strings
popUpData = get(hObject,'String');
% get the index of the current selection
popUpIndex = get(hObject,'Value');
% write out the selection name
fprintf('%s\n',popUpData{popUpIndex});
Try the above and see what happens!

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by