How to insert Images/icons in UiTables in app designer

40 ビュー (過去 30 日間)
Johnny Birch
Johnny Birch 2020 年 9 月 25 日
編集済み: Sebastian 2023 年 11 月 23 日
Hi guys
I am trying to insert images in a UiTable in app designer in the newly release r2020b. I am following the desription here https://se.mathworks.com/matlabcentral/answers/497260-figure-uitable-does-not-display-html-image-in-2019b
which is working fine when creating a new figure:
fig = figure;
t = uitable('Parent', fig,...
'Data', {'1';'2';'3'},...
'ColumnName',[],...
'RowName',[],...
'ColumnWidth', {100});
tick = 'C:\Users\evan\Workspaces\Trunk\Common\+images\Completed_16.png';
t.Data(:,2) = {['<html><img src="file:/', tick, '" height="16" width="16"></html>']};
however, I cant get it to work in App Designer, when i try this
app.UITable.Data(1,1) = {['<html><img src="file:/', tick, '" height="16" width="16"></html>']};
  3 件のコメント
Johnny Birch
Johnny Birch 2020 年 9 月 25 日
I am not interested in a checkmating in my case, just a image from a png file
Evan
Evan 2021 年 11 月 22 日
Well, you won't the png at 'C:\Users\evan...' as it's on my laptop!
I would also really apreciate being able to do this on a uifigure too though.

サインインしてコメントする。

回答 (2 件)

Rhea Chandy
Rhea Chandy 2020 年 9 月 30 日
編集済み: Rhea Chandy 2020 年 9 月 30 日
Hi Johnny,
It seems that you are trying to insert images in a UITable in app designer. That feature is undocumented in uitable in 2020b, although it may become supported in a future release.
There is are similar questions below:
You can consider using uiimage function to create a image component in your App Designer apps. This would create the image component in a new figure and return the Image object.
  1 件のコメント
Evan
Evan 2021 年 11 月 26 日
I believe the answers in the first two examples you have linked do not work when using a uifigure. He is specifically asking why those answers do not work in a uifigure but work when using a figure.
Creating a uiimage for each row of a uitable seems like a massive pain compared to adding html into a uitable box, is there any plan to introduce this capability for uifigures any time soon?

サインインしてコメントする。


Sebastian
Sebastian 2023 年 11 月 23 日
編集済み: Sebastian 2023 年 11 月 23 日
I am also struggling with this issue. Is there any progress? It does not seem to be possible to add images to a uitable (inside a uifigure). I also tried to add a uiimage and to use categories instead, but that does not work either.
Update: Sorry for the inconvenience. I now found a working example here.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by