MATLAB: How to combine data from multiple cells into one matrix

cell arrayscombine matrices

I have a cell that contains 233 matrices, each with data in it. I would like to pull all of this data into one matrix with 23 columns, however I run into problems because each matrix does not have the same number of rows, though they all have 23 columns. This code pulls most of the data into the matrix, but still overwrites some lines when multiple columns are being added from the same matrix.
load('initialdata.mat'); %1x233 cell
k=length(initial data);
for i=1:k
finaldata = zeros(23,500); %500 is arbitrary
m=1
z=0
for j = 1:500
j = m
[row column] = find(timecell{1,j});
if length(row) == 23
z= 1
for i = 1:23
finaldata(i,j) = (timecell{1,j}(1,i));
end
elseif length(row) > 23
for z = 1:length(row)/23
for i = 1:23
finaldata(i,j+z) = (timecell{1,j}(z,i));
end
end
elseif length(row) == 0;
z= 0
end
m = j+z
end
end
Thank you!

Best Answer

A={rand(4,23) rand(5,23) rand(10,23)}
B=cell2mat(A')