Guide Popupmenu adding an image?
Afficher commentaires plus anciens
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.

Réponse acceptée
Plus de réponses (1)
Jan
le 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 commentaires
Christopher
le 16 Nov 2014
Image Analyst
le 16 Nov 2014
Try
set(handles.popup1, 'String', {'Hello', ['<html><img src=', IconURI, '> String']})
Christopher
le 16 Nov 2014
Image Analyst
le 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};
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
