I have a cell that consists in many different arrays with different dimensions. For example, this could be my cell:
A = {[-1] [144x1 double] [-1] [331x1 double] [-1] [431x1 double] [-1] [512x1 double]}
I want to do a histogram with all the data contained in the cell. I've tried doing a cell2mat:
B = cell2mat(A);
in order to extract the data and then do the histogram, but it is giving this error:
??? Error using ==> cat
CAT arguments dimensions are not consistent.
Error in ==> cell2mat at 81
m{n} = cat(2,c{n,:});
Error in ==> function at 156
B = cell2mat(A);
I also tried creating a matrix with a loop:
for j=1:length(A)
B = [B; A{j}]
end
But the problem here is that MATLAB is using the same dimensions for all arrays and it is filling the empty spaces with 0.
How do I achieve this properly?