MATLAB: Operation without for loop

arraymatrix manipulation

I have two matrix.MAtrix A(250000×4)and MAtrix B(250000×4)
I have a function which result a scalar C.
C = myfunction(X,Y);
Now i want to pass each row of MAtrixA and MAtrixB to myfunction without using a for loop.
How to do it ?

Best Answer

Y = arrayfun(@(i1)myfunction(A(i1,:), B(i1,:)), 1:size(A,1))