title: Out of memory in Matlab - how to do in-place operation on matrix elements?
body: <p>I am loading a quite large matrix into Matlab. Loading this matrix already pushes Matlab to its limits - but it fits. </p>
  
  <p>Then I do the following and I get an out-of-memory error.</p>
  
  <p><code>data( :, 2:2:end, :, : ) = - data( :, 2:2:end, :, : );</code></p>
  
  <p>Is Matlab allocating a new matrix for this operation? I would assume this operation would not need extra memory. How do I force Matlab to be more efficient for this?</p>
  
  <p>Bonus question:</p>
  
  <p>'data = permute(data,[1 2 3 4 5 12 8 7 6 9 10 11]);'</p>
  
  <p>Can matlab do this in-place?  </p>