How can showing gif image during matlab processing

I am developing a code to show a gif image during matlab processing. When the process is finished, the gif image is closed and the result would be plotted. However, the gif image is stopped when the matlab processing is being processed.
gif_image='C:\Users\Amir\Desktop\spinner.gif';
[handles.im,handles.map] = imread(gif_image,'frames','all');
handles.len = size(handles.im,4); % number of frames in the gif image
delay_length = 0.2;
axes(handles.axes1)
hold(handles.axes1,'on');
imshow(handles.im(:,:,:,1),handles.map);
handles.count = 1;% intialise counter to update the next frame
handles.guifig = hObject;
handles.tmr = timer('TimerFcn', {@TmrFcn,handles.guifig},'BusyMode','Queue',...
'ExecutionMode','FixedRate','Period',delay_length); %form a Timer Object
guidata(handles.guifig, handles);
start(handles.tmr); %starts Timer
% Update handles structure
guidata(hObject, handles);
when this part is going to begin, showing the gif image is stoped. :(
try
[matlabImage mask1 col col1 x y boundaries]=read_img();

1 comentario

Jan
Jan el 28 de Ag. de 2017
What is the contents of TmrFcn()? Is this still executed during the computations? If not, this would be a better description: "The timer callback is not executed during processing".

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 28 de Ag. de 2017

0 votos

4 comentarios

amir nemat
amir nemat el 28 de Ag. de 2017
Editada: Jan el 28 de Ag. de 2017
Thanks for your respond.
h1 = uicontrol('style','push', 'pos', [1,1,637,630], ...
'String','<html><img src="file:/C:\Users\Amir\Desktop\spinner.gif"/></html>');
is working for me but I need to show it in axes1 ?
Jan
Jan el 28 de Ag. de 2017
On the undocumented site you can find a method to hide the border of a button, such that it should look like the image appears in the axes.
Matlab's axes object is not thought for displaying animated GIFs. You can emulate this by a timer callback, but you have seen the limitations already. So why do you want to display the animated GIF in an axes?
By the way: You did not answer my question, if the timer callback is triggered at all. It would be useful to know this, because perhaps it contains a bug only.
amir nemat
amir nemat el 29 de Ag. de 2017
Thanks for your respond. As I already wrote, I want to show wait gif when the processing is running. Do you mean, my code is wrong or the matlab has bug?
Jan
Jan el 29 de Ag. de 2017
I mean that axes objects are not suitable for animated GIF files.

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 28 de Ag. de 2017

Comentada:

Jan
el 29 de Ag. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by