title: Summing over first 2D of 3D matrix
body: <p>Suppose I have a 3D matrix <code>A</code> of size (1,2,3). Something like</p>
  
  <pre><code>A(:,:,1) = 
  [1 2]
  
  A(:,:,2) =
  [3 4]
  
  A(:,:,3) =
  [5 6]
  </code></pre>
  
  <p>How would I go about finding the 3 values that make up the sum of the first two dimensions, for example.</p>
  
  <pre><code>sum(A(:,:,1)  = 3
  </code></pre>
  
  <p>The above works, but when I try it for an array with larger dimensions, say <code>A</code> is size (5,5,5), then I get a 2D array back as an answer but I want a single value summing up the value of that array.</p>