title: Mean of a 4D array across selected dimensions
body: <p>I am using the <code>mean</code> function in MATLAB on a 4D matrix. </p>
  
  <p>The matrix is a <code>32x2x20x7</code> array and I wish to find the mean of each row, of all columns and elements of 3rd dimension, for each 4th dimension. </p>
  
  <p>So basically <strong>mean(data(b,:,:,c))</strong> [pseudo-code] for each <code>b, c</code>.</p>
  
  <p>However, when I do this it spits me out separate means for each 3rd dimension, do you know how I can get it to give me one mean for the above equation - <strong>so it would be</strong> (<strong>32x7</strong>=)224 means. </p>