MATLAB: How to cell array all data into a matrices cell array to matrix suppose i have a cell array a={{1,2,3};12;{21,32,43}}; how to get all data in single matrix b=[1,2,3,12,21,32,43]' Best Answer Use horzcat and cell2mat:b = cell2mat(horzcat(a{:}))produces:b = 1 2 3 12 21 32 43I didn’t initially see the transpose operator. To get it as a column vector, add the transpose:b = cell2mat(horzcat(a{:}))' Related SolutionsMATLAB: How to cell array all data into a matrices Slightly different with ‘A’ here, since it is a cell array of vectors and not a cell array of cells, so we do not need cell2mat this time:B = horzcat(A{:})produces:B = 1 2 14 16 19 6 12 15 20 3 4 7 17 MATLAB: Concatenate cell array along one dimension cellB = mat2cell(cell2mat(cellA),[12 12]); Related QuestionHow can i find the position of a number in a cell consisting of arrays/matrices with different sizesIteratively concatenate 3×4 matrices held in a structure with single line arrays held in a structureMultiply two matrix of quaterionsHow to combine cell row into any varible?Cell array to vector using cell2matConcatenate rows within a 3D cell arrayMinimum for different sized cell arrays
Best Answer