필터 지우기
필터 지우기

Find Vector of Index Without Using Loop

조회 수: 1 (최근 30일)
czeslaw
czeslaw 2018년 4월 27일
답변: Akira Agata 2018년 4월 27일
Hi all,
If I have
a=[2 3 4 5]
b=[3 5]
%what I want is the index of same elements between a and b, which gives:
i=[2 4]
I want to do this without having to use any loop, because the data is hundreds of thousands elements. Using find() will require me to use loop I think.
Please help. Thanks.

채택된 답변

Akira Agata
Akira Agata 2018년 4월 27일
Please try ismember function, like:
[~,idx] = ismember(b,a);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by