I'm converting some code from R and I'm having trouble with a line of code that I feel like there should be a built in function for in Matlab. In R, the function is:
match(x,table)
which returns a vector of the positions of (first) matches of its first argument in its second.
So if I have two vectors:
V1 = {1,2,3,4,5,6}
V2 = {3,4,2,1,5,6}
then match(V1,V2) will return:
{4,3,1,2,5,6}
Anyone know a way I can do this same thing in Matlab without having to write my own function?
Thanks!
match(x,table)
which returns a vector of the positions of (first) matches of its first argument in its second.
So if I have two vectors:
V1 = {1,2,3,4,5,6}
V2 = {3,4,2,1,5,6}
then match(V1,V2) will return:
{4,3,1,2,5,6}
Anyone know a way I can do this same thing in Matlab without having to write my own function?
Thanks!