Generating gifs that replay and controlling FPS in MATLAB
121 ビュー (過去 30 日間)
古いコメントを表示
I'm generating lots of figures representing a system and it would be useful to be if they were displayed in a GIF (so I don't have to keep clicking between them, they just skip automatically).
I'v been able to create a GIF using the exportgraphics command, the issues are:
1) it doesn't replay. After it has finished showing each image, it stops on the last image and thats it. I've tried saving and reloading, but the GIF stays stuck on the last image. I need to be able to save the file as a GIF to use with other software.
2) the FPS is really low. Ideally I'd like it to be about 50 frames over 2 seconds.
I'm using MATLAB online, I don't know if that helps
0 件のコメント
回答 (2 件)
Eshan Patel
2022 年 11 月 4 日
Hey William,
I see that you are using "exportgraphics" to create a GIF, and you require a better way to do it. You can address all the drawbacks you are currently facing by using the "imwrite" function, which will allow you to loop the GIF and add a custom delay to each frame.
0 件のコメント
DGM
2022 年 11 月 4 日
I don't have exportgraphics(), so I can't experiment with it, and I'm not sure how you're using it.
Off the top of my head, I don't recall how the loopcount is specified in the file header for GIF. My suspicion is simply that the way the file is being incrementally constructed is creating a problem.
That said, I use these tools for creating animated GIFs from 4D image arrays. You might have to do some extra intermediate work to get the images in that form, but that's what I have at hand. That'll handle per-frame delay specification, and it's infinite-looping by default.
There are other GIF tools on the FEX, but those are the ones I'm familiar with (because I wrote them).
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!