title: MATLAB: sum of one row
body: <p>I am trying to streamline my code. I have a 2-column array from which I'd like to extract the averages of the columns and store them as X and Y.</p>
  
  <p>I tried using the following code:</p>
  
  <pre><code>[x y] = mean(theArray);
  </code></pre>
  
  <p>...However, this returns</p>
  
  <pre><code>??? Error using ==&gt; mean
  Too many output arguments.
  </code></pre>
  
  <p>For now, I have settled with the three lines:</p>
  
  <pre><code>coords = mean(theArray);
  x = coords(1);
  y = coords(2);
  </code></pre>
  
  <p>I'm sure there <em>must</em> be a much simpler way of doing this in less than three lines. My code is running an eye tracking device at 1000Hz and I want to avoid any unnecessary processing...</p>
  
  <p>Any wisdom gratefully received</p>