Update image on appdesigner

40 ビュー (過去 30 日間)
Inception
Inception 2022 年 4 月 26 日
コメント済み: Inception 2022 年 4 月 28 日
Hi.
I have placed an image object on my app. Then, within the startupFcn, the image gets a source with
app.Image.ImageSource = "C:\image.png";
Another routine will change the content of the image. This means the file gets overwritten. The new image shall now be displayed on the app. I tried to update the image object by passing again the path to the file
app.Image.ImageSource = "C:\image.png";
... but nothing happens on the app. I next tried to first "delete" the path and then send a new one
app.Image.ImageSource = "";
app.Image.ImageSource = "C:\image.png";
But still the image is not been updated. What can I do to tell the app that the content of the image has changed? Is there a refresh function for images?

採用された回答

Kojiro Saito
Kojiro Saito 2022 年 4 月 26 日
uiimage's ImageSource allows "m-by-n-by-3 truecolor image array", so how about specifying image array?
overWrittenImage = imread('C:\image.png');
app.Image.ImageSource = overWrittenImage;
  1 件のコメント
Inception
Inception 2022 年 4 月 28 日
Yes, this does the job. Thank you! :)

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by