MATLAB: Concatenation inside cell arrays

cell arraysconcatenationMATLAB

Dear all,
I have a cell array that is made up of two cell arrays of (1×60) dimensions. Each one of them cell arrays of different dimensions. However, these dimensions are identical in both of them. Again, each one of these inner cell arrays contain multiple double matrices of the same size, but different from their counterparts in the other cell array with one dimension. What I have just said is illustrated for clarification in the image below:
What I would like to do is to concatenate the inner-most matrices each to its corresponding one along their first dimension (concat(17×12 & 13×12) => 30×12) as shown above. That will typically produce a single (1×60) cell array as shown above. I know I can do this with very complicated and time consuming loops, however, I would like your help to make it as compact as possible.
Yours, Maad

Best Answer

This is easy and efficient with a loop. I do not see, why you assume that it is "very complicated and time consuming".
% Input cells: A, B
C = cell(size(A));
for k = 1:numel(C)
a = A{k};
b = B{k};
ab = cell(size(a));
for kk = 1:numel(ab)
ab{kk} = [a{kk}, b{kk}];
end
C{k} = ab;
end