MATLAB: Concatenating doubles in cell arrays

cell arrays

Hi
I have two cell arrays, each of them 1×25. Each contains a 2×1 double array in the first 24 elements, and a 60×1 double array in the 25. I want to combine the two such that a new cell array would have a format of 1×25 as well, containing a 4×1 double array (concatenating of the original double arrays) in the first 24 elements, and a 120×1 double array in its 25th element – how can I do that? Thanks

Best Answer

Where A and B are the input cell arrays:
cellfun(@(a,b)[a;b],A,B,'UniformOutput',false)
Or even
cellfun(@vertcat,A,B,'UniformOutput',false)