matlab gui image changing

9 Ansichten (letzte 30 Tage)
Fco. Javier Rodríguez Mira
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?

Antworten (1)

Ajay Pattassery
Ajay Pattassery am 28 Mai 2020
Hello,
You can make use of uiimage to display images in the GUI.
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
  1 Kommentar
Fco. Javier Rodríguez Mira
Hi I've tested your code and It works but the vector I have has 34470 elements so I need the loop to be a little bit faster. It only has 0,1, 2 and 3 values and what I need is: when I have a 0 I need to display an arm image(brazo22) in repose, when is 1 I need to display an arm image in flexion(brazo11) ,when is 2 I need to display an arm image in extension (brazo33) and when it has a 3 I need to display the same image as when It's in repose(brazo22). I´ll attach a zip that contains the gui(poyecto.fig) the function of the gui with your code (proyecto.m), the images of the arm, another function that is the function where I extracted the code for the gui(SolucionP2_eje2.m) and a data archive(EMG 2 channel Wrist Flex_Ext_Raw.mat). In both of the .m archives is a vector called "salida" that is the vector with the 4 values. A brief summary of what I need is: I have a data archive that I have processed and then make a vector "salida" for the values in the previous data. Now I need to make a gui for that 3 values to display an image deppend on the value. The problem is that I need the loop to last 23.16 seconds but the vector "salida" has 34470 elements. Do you have any idea to make this possible? Thank you for your answer.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with Image Processing Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by