I have X and Y positions for a large array and I would like to use them to define what the contents of that position. I could run a for loop to define the positions but I think there would be a faster method. I tried to use the array position define function.
x = [6,2,3]
y = [1,2,3]
c = [1,1,1,2,2,3;...
1,1,1,2,2,5;...
2,2,1,4,2,3;...
1,1,4,3,2,3;...
1,2,3,4,5,3;...
1,2,3,5,4,2];
When I type the equation above it results in the answer below
c(y,x)
ans =
1 2 3
1 1 1
2 2 1
What I'm looking for are the 1:1 positions from the arrays.
c(y(1),x(1))
c(y(2),x(2))
c(y(3),x(3))
Is there any way to limit the arrays to a linear sequence? my only guess right now is to reshape the arrays into a cell matrix containing the individual a and b and then perform a cellfun. but I think I'm making it to complicated.