title: Matlab function and return values in a loop
body: <p>If I define a function like this</p>
  
  <pre><code>function [x, y] = findXY(B)
     [by, bx] = size(B);
     x = zeros(by,bx);
     y = zeros(by,bx);
     for i=1:10
         x(i) = i;
         y(i) = i; 
     end
  end
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p>The constructor for class 'findXY' must return only one output value.</p>
  </blockquote>
  
  <p>Why is this happening? I can't use return values in a loop?
  I didn't find something similar while googling.</p>