MATLAB: Create number of arrays dynamicly

arraycell arraycell arraysdynamic arraymatrix arrayworkspace

i have a matrix of [m,n], i want to create m arrays and store those m rows into those m arrays. any way of doing that? example: a=[1 2 3 4;5 6 7 8;9 10 11 12] this matrix has 3 rows so i want to create three arrays(A1,A2,A3) and store A1=[1 2 3 4] A2=[5 6 7 8] A3=[9 10 11 12] thanks in advance

Best Answer

Don't do that.
a_by_row = mat2cell(a, ones(1,size(a,1)), size(a,2));
now a_by_row{K} is the K'th row . You do not need one variable per row.