display an icon (in png format) in a cell of a uitable
조회 수: 20 (최근 30일)
이전 댓글 표시
Hi,
I need to build a table that displays the status of a service in a GUI I am working on. I am using the uitable to display this information. In the first column I need to place the required icon (tick if on, cross if off etc). I can't seem to find how to do this anywhere. I have no clue at all. Please help.
Thanks. Varsha
댓글 수: 0
채택된 답변
Nicolas
2011년 6월 13일
actually you nearly had it.
the problem is your html code.
properly it should say:
'<IMG SRC="http://mathworks.com/logo.tif">'
...and it works!
추가 답변 (1개)
Walter Roberson
2011년 2월 10일
There is no documented way to do this.
You can take advantage of the fact that text cells will be interpreted as HTML if they are in the proper format, such as
'<HTML><IMG="http://mathworks.com/logo.tif" >'
Using that I have been able to get the "broken link" icon, but I have not yet been able to get an actual image up. And you have to do nasty things to cell widths and fontsize to make room for the image.
댓글 수: 1
Jan
2011년 6월 13일
Try an existing and local file:
pic = fullfile(matlabroot, 'toolbox', 'image', 'icon', 'icon_info.png');
uitable('Data', {['<html><img src="file:/', pic, '"></html>']})
참고 항목
카테고리
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!