Progress or status bar while using getframe

조회 수: 1 (최근 30일)
Spigge
Spigge 2014년 8월 4일
편집: Amir 2014년 8월 5일
Hi
I would like to show a progress/status bar figure, for example Matlab's waitbar, while using getframe(f1) on a fullscreen figure f1 in a loop. The progress bar should obvioulsy always be on top and ideally not captured by getframe . Problem is that when getframe(f1) is called, it always puts f1 on top and the progress bar becomes hidden. Any ideas on how to display progress/status while using getframe would be greatly appreciated!
Thanks,
Fredrik

답변 (1개)

Amir
Amir 2014년 8월 4일
편집: Amir 2014년 8월 4일
Please try this code. May be this is not the exact answer for your question. But perhaps can be an alternative.
Z = peaks;
N=200;
fig=figure('Renderer','zbuffer');
surf(Z);
axis tight manual;
set(gca,'NextPlot','replaceChildren');
y=[];
for j = 1:N
% pause(0.1)
subplot(25,1,25);
y=[y,1];
bar(y);
set(gca,'xtick',[],'ytick',[]);
axis([0.5 N 0 1]);
subplot(25,1,1:23);
surf(sin(2*pi*j/20)*Z,Z);
F(j)=getframe(fig);
end
close all
[height, width, p] = size(F(1).cdata);
MovieFigure = figure;
set(MovieFigure, 'position', [150 150 width height]);
axis off
movie(MovieFigure,F);
  댓글 수: 2
Spigge
Spigge 2014년 8월 4일
Thanks Amir, I think it's an interesting and creative alternative. I'll consider it plan B if it turns out a separate status figure cannot be applied in conjuction with getframe.
Fredrik
Amir
Amir 2014년 8월 5일
편집: Amir 2014년 8월 5일
Hi Spigge. As you know " getframe returns a movie frame. The frame is a snapshot (pixmap) of the current axes or figure ". Therefore even if you could keep the status bar always on top, getframe cannot record your full screen and only records one of your figures. But if you need to record both the statusbar and your plot, I think you will need to capture the screen . I mean for each frame, first you need to plot your figure and then show the statusbar, then capture your screen. Then you can make a struct from the images (imread) similar to what getframe creates. But this also will have some problems. For example you will need to add a piece of code to remove the borders of windows (or when you were capturing the screen you should define your plotting area to be recorded).

댓글을 달려면 로그인하십시오.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by