필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Hi,I have a vector which contains 10 entries. I choose 6 entries among all entries. now I want to find out the index of chosen entries. how can i do this.?

조회 수: 1 (최근 30일)
for example: A=[1 3 5 2 7 4 9 1 4 5]; and chosen entries=[1 5 7 4 9 5].and the index I need to calculate is:[1,3,5,6,7,10]. I have no idea how to calculate index of chosen entries. thanks in advance

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 16일
편집: Azzi Abdelmalek 2016년 7월 16일
idx=find(ismember(A,entries))
%or maybe you want this
A=[1 3 5 2 7 4 9 1 4 5]
entries=[1 5 7 4 9 5]
B=A;
for k=1:numel(entries)
idx(k)=find(B==entries(k),1);
B(1:idx(k))=nan;
end
idx

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by