How can I automatically save a sequence of slice() images? It doesn't seem to fall under the same approach that plot() images do

 채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 24일

0 개 추천

It is exactly the same, getframe() / imwrite(), or print(), or saveas()

댓글 수: 2

J W
J W 2016년 1월 24일
편집: J W 2016년 1월 24일
Hmm. It seems as if I do:
x=1:1:3;
[X,Y,Z]=meshgrid(x,x,x);
u=sin(X);
h=slice(X,Y,Z,u,1,1,1);
imwrite(h,'test.jpg');
it results in a blank frame result
slice() returns a graphics object, not an array of data. imwrite() is only for writing arrays of data. One possibility using imwrite() is
x=1:1:3;
[X,Y,Z]=meshgrid(x,x,x);
u=sin(X);
slice(X,Y,Z,u,1,1,1);
pause(0.01); %draws and gives time to render
h = getframe(gca);
imwrite(h,'test.jpg');

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

추가 답변 (1개)

J W
J W 2016년 1월 24일
편집: J W 2016년 1월 24일

0 개 추천

Figured it out. Use a direct function handle.
h=figure;
slice(X,Y,Z,u,1,1,1);
saveas(h,'test.jpg');
I'll be accepting the previous answer because it was still correct.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

J W
2016년 1월 24일

댓글:

2016년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by