How would I go about mapping the values of TWO arrays to a function and returning the result as an array?
arr = [1, 2, 3];
arr2 = [1, 4, 5];
val= arrayfun(@(x) func(arr, arr2))
function val = func(x, y)
// Takes in two arrays, and does a double 'for' loop
// for all values in x, for all values in y, do x*y
So basically I would end up with an array of X Y val:
1 1 1 2 2 2 3 3 3 <- X values
1 4 5 1 4 5 1 4 5 <- Y values
1*1, 1*4, 1*5, 2*1, 2*4, 2*5, 3*1, 3*4, 3*5 <- X*Y values
Thanks.
EDIT - Updated desired output array
func
. I am just using the product as an example.