Progress or status bar while using getframe
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Amir
am 4 Aug. 2014
Bearbeitet: Amir
am 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 Kommentare
Amir
am 5 Aug. 2014
Bearbeitet: Amir
am 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).
Siehe auch
Kategorien
Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!