title: Armadillo C++: How to modify multiple array elements of a matrix using multiple elements from another matrix, specifically in a cube structure?
body: <p>In MATLAB, if I have two 3x3 matrices A and B and want to copy the last two columns of B into the first two of A, I would use the following syntax:</p>
  
  <pre><code>A(:,1:2) = B(:,2:3)
  </code></pre>
  
  <p>I am trying to complete the same action using Armadillo in C++, specifically for a cube structure. In Armadillo, if I had two cubes A and B with nine slices (with each slice being a 3x3 matrix), I assumed I would use the following to perform the same column element update:</p>
  
  <pre><code>A(span(0,2),span(0,1),span(i)) = B(span(0,2),span(1,2),span(i))
  </code></pre>
  
  <p>where 'i' is just the slice index. The syntax is based on the Armadillo syntax guide.</p>
  
  <p>The code compiles without error and runs; the cube slices are just not being updated. Am I using the correct Armadillo syntax here, and is this the most efficient way to perform these operations?</p>