要在循环中创建一组切片,必须通过替换调用中的最后一个参数来修改代码
contourslice
具体而言
i-th
数组的元素
Z
.
由于您没有发布输入数据,我已经在来自的示例数据上测试了拟议的解决方案
MatLab contourslice help
略微修改,其中
Yoy必须调整
Sx
,
Sy
Sz
要创建电影,您可以使用以下功能:
animated gif
通过使用函数
imwrite
% Load input data
[X,Y,Z,V] = flow;
% Define the parameters for the set of slices
Sx = 1:9;
Sy = [];
Sz = [];
cvals = linspace(-8,2,10);
% Open the FIGURE window
figure
% Create the axes and set tehiur properties
axis([0,10,-3,3,-3,3])
hold on
daspect([1,1,1])
campos([0,-20,7])
box on
% Create the movie object
mov=VideoWriter('contour_slice_movie.avi');
% Open the movie file
open(mov);
% Define the number of frames to be captured for each slice
n_frame_x_image=33;
% Loop over the desired number of slices
for i=1:length(Sx)
contourslice(X,Y,Z,V,Sx(i),Sy,Sz,cvals)
% Capture the frames
for j=1:n_frame_x_image
FF=getframe(gcf);
writeVideo(mov,FF);
end
end
% Close the movie file
close(mov);