Finding the position of valaue

1 Ansicht (letzte 30 Tage)
Pat
Pat am 24 Nov. 2012
i have two values
A=[50 90 45 10 5 15 20];
B=[10 90 45 50 5 20 15];
I have to find the position of A in B ,for example position of 50 in B is 4,position of 90 in B is 2
so the output will be
c=4 2 3 1 5 7 6
please provide assistance

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 24 Nov. 2012
Bearbeitet: Azzi Abdelmalek am 24 Nov. 2012
out=arrayfun(@(x) find(B==A(x)),1:numel(A))

Weitere Antworten (1)

Andrei Bobrov
Andrei Bobrov am 24 Nov. 2012
[out,out] = ismember(B,A);

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by