plot stuff on same figure in fullscreen mode
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Image Analyst
le 1 Fév 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!