MATLAB Answers

How put a gif on GUIDE

5 views (last 30 days)
Hi guys, can someone expain me how to put a gif please?
I need put this gif:
gifmathlab.gif here.png

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Sep 2019
GUIDE does not directly support playing GIFs.
What you can do is read the frames of the GIF and store them in an accessible place. Create an image() object in the appropriate axes with data initialized to all 0 and store the handle in an accessible place. Initialize an index to 1 in an accessible place. Then start a timer with a time interval equal to 1 divided by the desired frame rate.
The timer callback should retrieve the index, and retrieve the saved images, and retrieve the handle of the image object. It should set the CData property of the image object to the frames indexed at the current index. It should then increment the index by one, and if the result is greater than the number of frames, set it to 1, and it should save the updated frame index.

  8 Comments

Show 5 older comments
Jhon Rackham
Jhon Rackham on 16 Sep 2019
Oh, i see Mr Roberson, thanks.
Do you know how to put 2 pictures in the same GUIDE?
I wanna put a pic as background and a little one as logo.
Walter Roberson
Walter Roberson on 16 Sep 2019
img = imread('PathToBackground');
ax = handles.TagOfTheBackgroundAxesYouAlreadyCreated;
image(ax, img);
img = imread('PathToLogoImage');
ax = handles.TagOfTheLogoAxesYouAlreadyCreated;
image(ax, img);
Jhon Rackham
Jhon Rackham on 16 Sep 2019
Thanks a lot Mr Roberson.

Sign in to comment.

More Answers (0)

Sign in to answer this question.