MATLAB: Cell array to vector using cell2mat

cell arraysMATLABvector

I have a cell array {C} =1×12, with each cell consisting of only integers. All cells have different amounts of data
cell 1: [1 3 6 7]
cell 2: [ 6 7 12 34 33 66]
etc.
I want to create a vector
V = [ cell 1 cell 2….cell 12]
V= [ 1 3 6 7 6 7 12 34 33 66]
Thanks

Best Answer

Some alternatives:
V = cell2mat(C);
V = [C{:}];
V = horzcat(C{:});
V = cat(2,C{:});
Each of these can be adapted different for different situations, so it is useful to know similar (but different) way of achieving this.