Hi, I´d like to make a code that displays an image in a gui from a vector. I mean, I´ve got a vector that has the values 0,1,2 and I need to display in a gui an image depend on the value. I´ve got no idea to make this. Thank you.
So once you have created the salida array you need to determine which GUI action will invoke the process to display all the images one after the other. Let's assume that you have a pushbutton to do this. In the callback, you would place all of your code (that is right now in the OpeningFcn) to create the salida array, load the three images, and then cycle through each value in the array. Something like
image0 = imread('brazo22.jpg');
image1 = imread('brazo11.jpg');
image2 = imread('brazo33.jpg');
for k = 1:length(salida)
value = salida(k);
if value == 0 || value == 3
elseif value == 1
elseif value == 2
fprintf('error - invalid value: %d!\n', value)
pause(1.0); % <---- pause for one second
You can use a switch statement instead of the if/elseif if you'd rather. So we get the value of the kth element of the array, show the appropriate image (in the axes of your GUI), pause for one second (you can change this) and then move to the next element.