how to do coding on popup menu to display image
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
Geoff Hayes
am 23 Apr. 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!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!