Progress or status bar while using getframe

5 views (last 30 days)
Spigge
Spigge on 4 Aug 2014
Edited: Amir on 5 Aug 2014
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

Answers (1)

Amir
Amir on 4 Aug 2014
Edited: Amir on 4 Aug 2014
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 Comments
Spigge
Spigge on 4 Aug 2014
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 on 5 Aug 2014
Edited: Amir on 5 Aug 2014
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).

Sign in to comment.

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!