MATLAB: How to name every row of 100*2500 matrix

matrix manipulation

currently i am working with a matrix. The dimension of the matrix is 100*2500. I need to assign each row the matrix to a new variable. How i can do this?

Best Answer

"So all I want is as followings" See TUTORIAL: Why Variables Should Not Be Named Dynamically (eval). However, I guess you need to make your own mistakes to understand that it's a really bad idea.
M = ones( 3, 5 );
for rr = 1 : size(M,1)
variable_name = sprintf( 'row%03d', rr );
assign( variable_name, M(rr,:) );
end
where
function assign( varargin )
switch nargin
case { 2 },
if isvarname( varargin{ 1 } )
Name = varargin{ 1 };
else
error( ['poi: First input argument, ', ...
inputname(1), ' must be a legal name'] ),
end,
Value = varargin{ 2 };
otherwise
error( 'poi: Wrong number of input arguments' ),
end
assignin( 'caller', Name, Value );
end