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

조회 수: 3 (최근 30일)
Stefan
Stefan 2011년 8월 24일
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

채택된 답변

Jan
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.

추가 답변 (1개)

Stefan
Stefan 2011년 8월 29일
Hello Jan,
thanks for your answer. So I will kick this animation out of my GUI.
Greetings,
Stefan

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by