generating animation (e.x. animated gif) while function is running
3 次查看(过去 30 天)
显示 更早的评论
Hi at all,
I have programmed a tool that analyzes measured data, performs several calculations and generates an excel report at the end. Some of its functions or better calculations take a bit of time for their execution, so I want to generate a small animation on the Main-GUI to show the user that the tool is still running.
My idea is to put an animated gif on the GUI while the functions are running and to replace it by an still image when the tool is on idle.
Is this possible somehow? Or, if not is there an other way to achieve this idea?
Thanks for your help.
Greetings, Stefan
0 个评论
采纳的回答
Jan
2011-8-24
You cannot display an animated GIF with standard MATLAB methods.
Usually a progressbar is displayed for such jobs. Beside MATLAB's WAITBAR, there are a surprising large number of submissions in the Fex: progressbar? .
If your code contains a loop, you can update an image after a certain time step. Or you can create a timer object, which updates an image object. A DRAWNOW might be needed to allow the timer's callback to be executed.
If you call a single command, which takes a lot of time (e.g. invert a giantic matrix), I do not know a sufficient method, because MATLAB is a single threaded application (even if it calls multi-threaded subfunctions) and the main thread cannot be interrupted. It should be possible to start an independent external function, which updates an animation, but this will niot appear inside the MATLAB figure.
0 个评论
更多回答(1 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!