Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
There are two arrays:
A=[2,6,9,10]; B=[6,10,9,2,2,9,10,10,6,6,2,9];
I want to output the following array:
C=[2,4,3,1,1,3,4,4,2,2,1,3];
How to do this work?
I found the solution, [~,C]=ismember(B,A);
[~,C]=ismember(B,A)
Add a comment
My answer shall be C=arrayfun(@(x) find(A==x),B)
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.