how can i build a for loop to create histograms for a multiple cell array?
Show older comments
i have a multiple array cells (result):


there are 20 cells and each cell contains other 20 cells. I would like to create an histogram of each cell data, so in total 400 histograms. I built this code but if I have ii=1 i have L_nod starting from result{1,1}{1,2}. I want that it starts from result{1,1}{1,1} and increase each time.
for ii = 1:length(result)
figure(ii)
L_nod = result{1,ii}(:,ii+1)
L_nodo1 = cell2mat(L_nod);
[n,x] = hist(L_nodo1,50);
n = n/length(L_nodo1)/diff(x(1:2));
bar(x,n,'hist')
pngFileName = sprintf('hist%d.png',ii);
fullFileName = fullfile(folder, pngFileName);
saveas(gcf,fullFileName);
end
maybe is not clear, if anybody has a new code to suggest to me i'm glad :).
Thanks!
2 Comments
Image Analyst
on 6 Mar 2019
Can you attach the results in a .mat file?
And why is result a cell array? From what I see, it could be done much simpler with just a regular double array. I mean, none of the arrays have different sizes -- they're all 80 by 1 -- so why use cells instead of a 2-D double array?
EM geo
on 7 Mar 2019
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!