Progress or status bar while using getframe

2 次查看(过去 30 天)
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