MATLAB: How to convert a matrix to cell array of vectors

arraycelldatamatrixvector

I have a matrix M x N matrix: R. r1 = R(1,:); r2 = R(2,:); etc. How to create cell array {r1,r2,…} from R automatically?

Best Answer

out = num2cell(R,2);