Guide Popupmenu adding an image?
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
更多回答(1 个)
Jan
2014-11-15
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 个评论
Image Analyst
2014-11-16
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};
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!