plot stuff on same figure in fullscreen mode
2 views (last 30 days)
Show older comments
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; "
0 Comments
Accepted Answer
Image Analyst
on 1 Feb 2012
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 Comments
More Answers (0)
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!