"Include video clips of rotating graphs"

To be honest this question is school related, but its not for a Matlab course. Its for Fluid Dynamics, so I won't get in trouble for asking this question.
I am using scatter3 to plot data points that I obtained from experiment. To complete the assignment I must "Include video clips of rotating graphs."
I have no idea how to do this.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 12월 12일

0 개 추천

See the documentation for VideoWriter : it has an example.

댓글 수: 2

Phillip
Phillip 2012년 12월 12일
편집: Phillip 2012년 12월 12일
I tried to modify to code to work with a scatter3 plot, but I get an error that the frame size must be 435 x 343.
Here is the code that gave the error:
writerObj = VideoWriter('peaks.avi'); open(writerObj);
Z = peaks(3); scatter3(Z(:,1),Z(:,2),Z(:,3));
axis tight
set(gca,'nextplot','replacechildren');
set(gcf,'Renderer','zbuffer');
for k = 1:20
camorbit(18,0)
frame = getframe;
writeVideo(writerObj,frame);
end
close(writerObj);
Walter Roberson
Walter Roberson 2012년 12월 12일
You would get that response if the frame that you grab is not always the same size. You can specify the frame location and size when you getframe()
Also note that it is sometimes necessary in practice to add a pause(0.2) before the getframe() call, that sometimes even drawnow() is not good enough.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

질문:

2012년 12월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by