Update Webdesigner App Image component- how??
4 次查看(过去 30 天)
显示 更早的评论
I've made a gui and it has an image component that i would like for the image to update automatically (without me having to click it). I've made a matlab scrip that produces a plot and i would like the image component in the gui to update once the image is ploted and stored in some folder. I have a button in the gui called "calculate" and once its clicked that runs the external matlab scrip the creates the plot and saves it as a png. for some reason i can't get the image component to update. is this even possible?
0 个评论
回答(1 个)
Kojiro Saito
2024-3-14
To update an image of uiimage component, change the ImageSource property.
app.Image.ImageSource = 'test.jpg'
But it does not refresh when the image file name is the same as described in Why does uiimage does not update when the file linked to ImageSource changes?
So, if you're using the same file name as an input of ImageSource, imread would do the trick.
testScript; % Run some script and out.jpg will be stored in image folder
app.Image.ImageSource = imread('image/test.jpg'); % Read the image and refresh the Image Component
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!