When I play my movie, why is it displayed at an offset from the created axes?
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 19 Feb 2021
When I play my movie in MATLAB, why is it displayed at an offset from the created axes?
For example,
Z = peaks(50);
hfig = figure;
hsurf = mesh(Z);
t=linspace(0,2*pi,16);
set(gca,'zlim',[-10 10]);
for i = 1:15,
Zi = Z.*cos(t(i));
set(hsurf,'zdata',Zi,'cdata',Zi);
M(i) = getframe(hfig);
end;
movie(M);
Why does playing this movie seem to create a new axes and display the movie at an offset from the created axes?
Accepted Answer
MathWorks Support Team
on 19 Feb 2021
Edited: MathWorks Support Team
on 19 Feb 2021
This enhancement has been incorporated in Release 2006b (R2006b). For previous product releases, read below for any possible workarounds:
When playing a movie, the default location of the output is in the current axes, and not the current figure. To force it to play in a specified figure, the handle to the figure needs to be passed to the MOVIE function. This will prevent MOVIE from creating a set of axes and playing the frames inside of the axes. For example,
Z = peaks(50);
hfig = figure;
hsurf = mesh(Z);
t=linspace(0,2*pi,16);
set(gca,'zlim',[-10 10]);
for i = 1:15,
Zi = Z.*cos(t(i));
set(hsurf,'zdata',Zi,'cdata',Zi);
M(i) = getframe(hfig);
end;
figure
movie(gcf,M);
This method of calling MOVIE is described in the documentation that can be found at the following URL:
0 Comments
More Answers (0)
See Also
Categories
Find more on Movie 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!