Azzera filtri
Azzera filtri

generating animation (e.x. animated gif) while function is running

2 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Jan
Jan il 24 Ago 2011
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.

Più risposte (1)

Stefan
Stefan il 29 Ago 2011
Hello Jan,
thanks for your answer. So I will kick this animation out of my GUI.
Greetings,
Stefan

Categorie

Scopri di più su Animation in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by