MATLAB: Combining cell arrarys to one cell

cell arrays

I have a cell array containing a number (say n) of 1×4 cells. I want to combine them in one cell to obtain a cell of nx4 cells. please let me know the solution.
Thanks all.

Best Answer

I think you want to concatenate the n cells into a simple n-by-4 array, like this
C = {[1 2 3 4],[2 3 4 5],[4 3 2 1]} % n=3 cells, each holding a 1-by-4 array
M = cat(1,C{:}) a n=3-by-4 array