I have a matrix I
, and I want to accumulate in an array A
, for each value in I
, an interval accordingly to those values in I
lets call them i
and j
.
function acc(i,j)
global A
A(i:j) = A(i:j)+1;
end
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.
Is there any way of speeding it up? How can I pass an return those values without global?