How to separately subplot a X*Y*Z (3D) matrix matlab? -
i'd create 4 subplots each containing 16 figures. each figure 1 dimension of matrix gw. i.e. gw(:,:,1) first image. here loop first 16 images in first subplot. how should modify loop 3 more subplots? first subplot should contain first 16 images, second subplot should contain second 16 images , on. following loop i'm getting first 16 images 4 subplots.
for i=1:4 figure(i); hold on; jj = 1:16 subplot (4,4,j) imshow (gw(:,:,j)); end end
you need modify how access 3rd dimension of gw. try this:
num_figures = 4; % because dont magic numbers in code subplots_per_figure = 16; % same here i=1:num_figures figure(i); hold on; j = 1:subplots_per_figure subplot (4,4,j) imshow (gw(:,:,j+(i-1)*subplots_per_figure)); end end
Comments
Post a Comment