plot stuff on same figure in fullscreen mode

조회 수: 6 (최근 30일)
Saad
Saad 2012년 2월 1일
Hi, I am trying to plot some stuff on a figure, and then saving it in a video (figure has to be in fullscreen mode otherwise some stuff in video won't be clearly visible). The problem is that I have to close the figure after getting each frame, otherwise it keep plotting stuff on new figures. I have tried using "figure(1)" but when i provide it the position "figure(1,'Position',[0 0 fullscreen(3) fullscreen(4)])" it gives an error.
my current code is " fullscreen = get(0,'ScreenSize'); h = figure('Position',[0 0 fullscreen(3) fullscreen(4)]);hold on %% I Plot some stuff here on the figure already created currFrame = getframe(h); writeVideo(videoObj,currFrame); close all; "

채택된 답변

Image Analyst
Image Analyst 2012년 2월 1일
Well don't call figure each time. That's what's creating the new figures. Call set() instead, like this:
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure.
% Give a name to the title bar.
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
If you have h in advance because you created the figure before your loop starts (which you should do), you can use h instead of gcf.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by