title: How to condense n-1, n-2, ... in a for loop (matlab)?
body: <p>I am looking to input criteria as the size of the matrix decreases each time. </p>
  
  <p>I have tried to simplify what I am doing to see if condensing it is even feasible.</p>
  
  <p>Would there be a way to simplify the following so n-1, n-2, and so on is not needed and the code could adapt to the input matrix. </p>
  
  <pre><code>a = [2 4 5 6; 7 5 3 5; 6 7 9 4];
  a
  n = length(a(1,:));
  b = [5];
  
  for i = n,
  
      a = a.*b;
  
      a(:,n-1)=[];
  
      a
  
      a = a.*b;
  
  a(:,n-2)=[];
  
  a
  
  a = a.*b;
  
  a(:,n-3)=[];
  
  a
  
  end
  </code></pre>
  
  <p>I want to be able to see the output at each iteration.
  E.g.:</p>
  
  <pre><code>a =
  
       2     4     5     6
       7     5     3     5
       6     7     9     4
  
  
  a =
  
      10    20    30
      35    25    25
      30    35    20
  
  
  a =
  
      50   150
     175   125
     150   100
  
  
  a =
  
     750
     625
     500
  </code></pre>