title: Fast array as argument passing in MATLAB
body: <p>I have a matrix <code>I</code>, and I want to accumulate in an array <code>A</code>, for each value in <code>I</code>, an interval accordingly to those values in <code>I</code> lets call them <code>i</code> and <code>j</code>.</p>
  
  <pre><code>function acc(i,j)
    global A
    A(i:j) = A(i:j)+1;
  end
  </code></pre>
  
  <p>However, passing and returning the arrays take too much time, because I execute the function many times, and it is not as simple as that example.</p>
  
  <p>Is there any way of speeding it up? How can I pass an return those values without global?</p>