简体   繁体   English

如何分别对X * Y * Z(3D)矩阵matlab进行子图绘制?

[英]How to separately subplot a X*Y*Z (3D) matrix matlab?

I'd like to create 4 subplots each containing 16 figures. 我想创建4个子图,每个子图包含16个图形。 Each figure is one dimension of the matrix GW. 每个图是矩阵GW的一维。 Ie GW(:,:,1) is the first image. 即GW(:,:,1)是第一张图片。 Here is my for loop for the first 16 images in first subplot. 这是第一个子图中前16个图像的for循环。 How should I modify the for loop to get 3 more subplots? 我应该如何修改for循环以获得3个以上的子图? The first subplot should contain first 16 images, second subplot should contain second 16 images and so on. 第一个子图应包含前16个图像,第二个子图应包含后16个图像,依此类推。 With the following loop I'm getting first 16 images for all the four subplots. 通过以下循环,我将获得所有四个子图的前16张图像。

for i=1:4
        figure(i);
        hold on;

        for jj = 1:16
              subplot (4,4,j)
              imshow (GW(:,:,j));
        end
end

You just need to modify how you access the 3rd dimension of GW. 您只需要修改访问GW的第3维的方式即可。 Try this: 尝试这个:

num_figures = 4;  % because I dont like magic numbers in the code
subplots_per_figure = 16;  % same here
for i=1:num_figures
        figure(i);
        hold on;

        for j = 1:subplots_per_figure
              subplot (4,4,j)
              imshow (GW(:,:,j+(i-1)*subplots_per_figure));
        end
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 3D 图像 alignment:如何从 matlab 中的 3x3 旋转矩阵中提取关于“静态”x、y、z 轴的旋转角度 - 3D image alignment: How to extract rotation angles about “static” x,y,z axes from a 3x3 rotation matrix in matlab 如何使用MATLAB将2D(x,y)坐标转换为3D(x,y,z)坐标? - How to convert 2D(x,y) coordinates to 3D(x,y,z) coordinates using MATLAB? 基于x,y,z数据的matlab 3d图形 - matlab 3d graph based on x,y,z data 如何基于f(x,y,z)= 0之类的函数在Matlab中绘制3D图形? - How to plot a 3D figure in matlab based on a function like f(x,y,z)=0? 如何将 3D 坐标 (x,y,z) 转换为 MATLAB 中的.STL 文件? - How to convert the 3D Coordinates (x,y,z) into .STL file in MATLAB? 在MATLAB中如何从具有中心点和X,Y,Z长度的3D体积中提取立方体? - how to extract a cube from a 3D volume having a centre point and lengths of X, Y, Z in MATLAB? Matlab:如何在(x,y,z)坐标中绘制堆叠的3D条形图? - Matlab: how to plot a stacked 3D bar plot in (x,y,z)-coordinates? 如何在matlab中找到等于z的二维矩阵的x和y值 - How to find all x and y value of 2D matrix equal to z in matlab 如何使用Matlab拟合表面((x,y,z)矩阵)? - How to fit a surface ((x,y,z) matrix) using Matlab? matlab:在 3d 图中绘制 x、y 和 z 轴上的 2d 线 - matlab: Graph 2d lines on x,y and z axis in a 3d plot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM