Check out the Examples tab ^^^.
This function is intended to streamline the process of making gifs. Simply call
to first the first frame, and then call
to write each subsequent frame. That's it.
Chad Greene (2019). gif (https://www.mathworks.com/matlabcentral/fileexchange/63239-gif), MATLAB Central File Exchange. Retrieved .
Can we use the same function on multiple images to save them as a gif? and How??
Thanks for the function.
To save sequence of images, I have to use imshow(myImage) and gcf. Is it possible to save without visualizing, directly?
Thanks so much!
@tanq: Just specify 'frame',gcf to capture the entire figure rather than the default frame (gca), which only captures the current axes. By capturing the entire figure it should include the title.
Hello Chad, thanks for great work, but how could add the title in loop? thank a lot
Aidan: To include a colorbar specify 'frame',gcf when calling gif the first time. That will ensure everything within the figure gets giffed. (The default frame is gca, which does not include colorbars outside the current axis.)
Thanks Ethan. For some reason, I am still getting error messages with the line gif('myfile.gif') . When I comment this part out, the loop works but only runs through one time then stops.
For reference, I have all the code in one file instead of "creating a new gif file" like the example suggests, because I couldn't figure out how to do that. Not sure if that matters as it seems to still work for one loop. Thanks again!
Is there a minimum 'DelayTime'? I seem to be able to increase it beyond the default, but when I go any lower (0.005 for instance), the gif is still only doing 1/15 frames per second.
Alexandar, make sure the gif.m function is in your current directory when calling it
When I try to use the run the line gif('myfile.gif') , I am given the error message "Cannot find an exact (case-sensitive) match for 'gif'". Any idea how to get around this? Thanks!
A well-documented and easy-to-use function that saved me a lot of time! Thanks, Chad.
Great function, however is there a way to include a colorbar in the gif? Cheers,
Please disregard my previous question; earlier in the script I had written "hold on" which led to the undesired overlay.
Great function! I was wondering if there's a way to remove the alpha channel from each frame? When using this function to make a sequence of plots, all the lines just superimpose over each other.
In response to Fabian . I got the same but then I read the documentation . The command is
web('myfile.gif') put in whatever your gif is called
While using the function it only records the first frame. When i use gif to add the subsequent frames nothing happens. I only get a gif with one static frame. Any ideas ?
Hi Andrea, thanks for the note. The error you mention is strange--there is no "cq" function in the gif function, and I don't think it's in anything the gif function calls either. Is cq a typo in your script, by chance? If you can post the whole error message that might help us track down the cause.
In Matlab 188.8.131.526344 (R2017a) I get the following error when running the example:
Undefined function 'cq' for input arguments of type 'uint8'