matlab gui image changing
9 ビュー (過去 30 日間)
古いコメントを表示
Hi, i'm trying to make a gui that changes an image with the value of a vector, I mean, i've got a vector that has 0, 1 and 2 values and i need to show an image for each value. Can be possible?
回答 (1 件)
Ajay Pattassery
2020 年 5 月 28 日
Hello,
I am not sure, whether you are looking for this. I just read three images and display them for a duration of 1second and show the other image based on the value in the vectorInput.I have a one to one mapping between vectorInput values 0,1,2 with img0,img1 and img2.
img0 = imread('membrane.png');
img1 = imread('peppers.png');
img2 = imread('football.jpg');
vectorInput = [0 0 1 2 2 0];
f= uifigure();
img =uiimage(f);
for i=1:length(vectorInput)
if(vectorInput(i) == 0)
img.ImageSource = img0;
elseif(vectorInput(i) == 1)
img.ImageSource = img1;
else
img.ImageSource = img2;
end
pause(1);%Holding image for 1 second
end
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!