getting intersected index without ruining an order of the original data.

1 view (last 30 days)
Assuming that, A=[1234 345 675 11 2], and B=[345 2 11 2]
Don't know how to get a reference matrix from B to A as like ans=[2 5 4 5]

Accepted Answer

Star Strider
Star Strider on 26 Nov 2017
Use the ismember function:
A=[1234 345 675 11 2];
B=[345 2 11 2];
[~,C] = ismember(B,A)
C =
2 5 4 5

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!