Movie function via getframe(gcf) displays multi-axis figure incorrectly
Show older comments
I have a problem where the movie() function creates an extra set of axes that I do not want around the outside of my figure, where no axes previously existed. More problematically, these axes push relevant info outside of the movie frame. Therefore I can't save a useful Avi file for presentations.
The code I'm using (minus irrelevant pieces) is:
for LOOP_PARAM=1:i_frame
%%%Data generating code%%%
%(define fw,fh,axh,axw etc... all my axis and figure sizes)
% Setup overall figure
f = figure;
set(f,'Units','inches','Position',[0 0 fw fh]);
set(f,'PaperPosition',[0 0 fw fh],'PaperSize',[fw fh]);
set(f,'Color','w','InvertHardcopy','off');
set(f,'Resize','off');%,'Toolbar','none');
set(f,'defaultAxesFontSize',16);%,'defaultaxesfontname','cmuserif');
% Setup axes within figure "f"
ax(1) = axes('Units',units,'position',[axl axb+0.5*axh+axvs axw2 axh]);
ax(2) = axes('Units',units,'position',[axl+1*(axw2+axhs) axb+0.5*axh+axvs axw1 axh]);
ax(3) = axes('Units',units,'position',[axl+1*(axw2+axhs) axb axw1 0.5*axh]);
%%%Section plotting Data%%%
%Capture movie frame
my_mov(LOOP_PARAM) = getframe(gcf);
end % frameloop
I can "fix" matlap playback of the movie if I play it via the following code from Matlab website, but that doesn't help with the key goal of getting this into an avi file I can use for presentations, as the cdata still has the axis around the entirety of figure f (that I don't want). I should note that I don't really know why this code works... axis are automatically 150 pixels wide perhaps?
% use 1st frame to get dimensions
[h, w, p] = size(my_mov(1).cdata);
hf = figure;
% resize figure based on frame's w x h, and place at (150, 150)
set(hf,'Position', [150 150 w h]);
axis off
% Place frames at bottom left
movie(hf,my_mov,1,0.5,[0 0 0 0]);
So, any thoughts on how I can get a movie file which just shows the three axes inside the main figure, which I can then save via mov2avi?
Many thanks for any help
PS. Running MatlabR2012b on MacOSX
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!