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,:) );endwherefunction 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 Related QuestionHow to write a1=1;a2=2;a3=3; from AUser input to change the name of an existing variableSimulinkのサブシステムの表示についてSimulinkモデルを実行した際の計算所要時間の表示方法 a a a aHow to split and save .txt columns using for loopHDL Verifierでコシミュレーションする際のシミュレーション速度について
Best Answer