Progress or status bar while using getframe
1 回表示 (過去 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
0 件のコメント
回答 (1 件)
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 件のコメント
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 Center および File Exchange で Dialog Boxes についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!