matlab - Subplot iterating through cell arrays -
i'm trying iterate on cell
array , sub-plot each image that's stored there.
see code:
for i=1:96 j=1:9 subplot(ceil(sqrt(960)),ceil(sqrt(960)),i) imshow(trainingdata{2}{i}{j}) end end
i have 96 cells (in i
column) each contain 10 images (j
column) (of first 9 want plot).
i know it's pretty pointless because they're small, i've started , seems can't working how thought, i'd know i'm going wrong before drop it. (also program may have less images in future anyway).
so far, it's sub-ploting 96 entries; should 864:
in case data structure confuses you, here's little explanation:
trainingdata
mat file load, first column needs 1 if want access persons name, or 2 if want images. second column contains 96 people (from 1 96. third column 10 pictures of person.
eg. trainingdata{2}{56}{7} accesses 56th persons 7th photo.
i'm sure many see unorthodox data structure, that's how thought of doing @ time. thanks.
the problem seems line
subplot(ceil(sqrt(960)),ceil(sqrt(960)),i)
which causes 9 images in inner loop overwritten in same subplot (so last 1 seen). change to
subplot(ceil(sqrt(960)),ceil(sqrt(960)),(i-1)*9+j)
so subplots used.
Comments
Post a Comment