matlab gui image changing
9 views (last 30 days)
Show older comments
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?
Answers (1)
Ajay Pattassery
on 28 May 2020
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
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!