Convert rows of a matrix to vectors
问题 I have a matrix lets say: A=[1 2 1; 5 6 7; 7 8 9] and I want to extract its rows in the following format: x_1=[1 2 1] x_2=[5 6 7] x_3=[7 8 9] I want to know how I can write x_1 , x_2 , x_3 . I know how to extract the rows but I don't know how to make my x_1 , x_2 and x_3 . I want this to be automatic , because my real matrix has a very large size and I don't want to make x_1 x_2 .. x_100 by hand. 回答1: You can try the following: m = size(A,1); for i=1:m % set the variable name varName =