![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176751/image.gif)
Guide Popupmenu adding an image?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Christopher
am 14 Nov. 2014
Kommentiert: Image Analyst
am 16 Nov. 2014
How can you add an image to a popupmenu using guide? An example picture of what I am trying to do is shown below. I have been trying to figure this out with no luck. Any help is appreciated.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146113/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Jan
am 15 Nov. 2014
You can include images using HTML:
Icon = fullfile(matlabroot,'/toolbox/matlab/icons/matlabicon.gif');
IconURI = ['"file:/', strrep(Icon, '\', '/'), '"'];
uicontrol('Style', 'popupmenu', ...
'String', {'Hello', ['<html><img src=', IconURI, '> String']})
4 Kommentare
Image Analyst
am 16 Nov. 2014
That's not right. Look at the code in comments. What you call contents is actually the index that is selected. To get the contents and index:
selectedIndex = get(handles.popup1, 'Value');
allContents = get(handles.popup1,'string');
selectedContents = allContents{selectedIndex};
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!