title: MATLAB - Creating changing row titles within for loop that can be used as Matrix row labels
body: <p>I am trying to creating a table from a matrix within a for loop. </p>
  
  <p>The problem I am having is creating a label for the rows that adds a new row each time the loop progresses. The code works for the first loop, and RLABEL updates itself for the 2nd loop but then when I come to print the matrix it says that there isn't enough row labels.</p>
  
  <p>I was just wondering whether there was a way of MATLAB reading that there are 2 row labels from RLABEL without having to input them all manually each time?</p>
  
  <p>Below is a copy of my code</p>
  
  <pre><code>d = 2;           
  kij = [1,2];       
  uMatrix = zeros(1:2);    
  for j=1:d        
       RLABEL(j,:) = ['Row','',int2str(j)]   %Creates Row string that updates itself each loop
       Px = rand                          
       var = (5/12)*d*sum(kij)             
       lam = 1/sqrt(var)                  
       u(j) = ((log(1-Px))/-lam)+kij(1,j)    
       uMatrix(j,1) = j;  
       uMatrix(j,2) = u(j)
       printmat(uMatrix,'Results',RLABEL,'SECTION u' )    
  end
  </code></pre>