簡體   English   中英

如何分別對X * Y * Z(3D)矩陣matlab進行子圖繪制?

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

我想創建4個子圖,每個子圖包含16個圖形。 每個圖是矩陣GW的一維。 即GW(:,:,1)是第一張圖片。 這是第一個子圖中前16個圖像的for循環。 我應該如何修改for循環以獲得3個以上的子圖? 第一個子圖應包含前16個圖像,第二個子圖應包含后16個圖像,依此類推。 通過以下循環,我將獲得所有四個子圖的前16張圖像。

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

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

您只需要修改訪問GW的第3維的方式即可。 嘗試這個:

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM