inserting image in a table

29 views (last 30 days)
Fatima Rashid
Fatima Rashid on 21 Apr 2019
Answered: Walter Roberson on 21 Apr 2019
Hey, I want to add an image to the table and then in next cell add it's quantitative measure(found through quality metrics). How can that be done in matlab?

Answers (1)

Walter Roberson
Walter Roberson on 21 Apr 2019
With traditional figures (**not** App Designer), you create a uitable. The column that is going to contain the images has to be marked as character; the column for the quantitative measure can be numeric if appropriate.
Now, each cell entry that is going to have an image, code the content of the entry as (for example)
'<html><img="https://www.mathworks.com/help/examples/matlab/win64/MatlabLogoExample_05.png"></html>'
If you use a file: URL, be sure to put in file:// before the path and be sure to use any leading directory separator for the path. For example on my system, file://Applications/MATLAB_R2019a.app/something.png would not work: I would have to use file:///Applications/MATLAB_R2019a.app/something.png
Now, you will find that unless the image is quite small that most of it will be cut off. You can create wider columns programmatically, but creating taller columns is tricky unless you go in at the Java that underlies uitable .
Considering the size difficulties, you might find it easier to program a completely different method, such as tossing up some uicontrol style edit to the right of an axes that you put images on (see the XData and YData properties of image objects.)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!