title: Swapping two columns not working
body: <p>I want to select two random columns of a matrix and swap them. I use:</p>
  
  <pre><code>S(:,[round_i round_j]) = S(:,[round_j round_i]);
  </code></pre>
  
  <p>But my code seems to produce the same matrix as before. Below are a code snippet and output of the command window.</p>
  
  <pre><code>function swapped_schedule=swapRounds(S)
  global weeks;
  
  round_i=randi(weeks)
  round_j=randi(weeks)
  
  while round_j~=round_i
      round_j=randi(weeks);
  end
  
  S(:,[round_i round_j]) = S(:,[round_j round_i]);
  
  swapped_schedule=S;
  
  end
  </code></pre>
  
  <p>Schedule is the matrix I pass to the function <code>swapRounds()</code>. The output is shown as follows:</p>
  
  <pre><code>schedule =
  
       4    -4    -6     5    -2     6     2     3    -5    -3
       5    -6    -4     4     1     3    -1    -5    -3     6
      -6     5    -5     6     4    -2    -4    -1     2     1
      -1     1     2    -2    -3     5     3    -6     6    -5
      -2    -3     3    -1    -6    -4     6     2     1     4
       3     2     1    -3     5    -1    -5     4    -4    -2
  
  
  round_i =
  
       4
  
  
  round_j =
  
       6
  
  
  ans =
  
       4    -4    -6     5    -2     6     2     3    -5    -3
       5    -6    -4     4     1     3    -1    -5    -3     6
      -6     5    -5     6     4    -2    -4    -1     2     1
      -1     1     2    -2    -3     5     3    -6     6    -5
      -2    -3     3    -1    -6    -4     6     2     1     4
       3     2     1    -3     5    -1    -5     4    -4    -2
  </code></pre>
  
  <p>How do I get this code to swap my two columns?</p>