필터 지우기
필터 지우기

extract Vector's index from Matrix

조회 수: 2 (최근 30일)
Fatma Gargouri
Fatma Gargouri 2011년 11월 14일
Hello,
I have a matrix M size(M)=n*2
and a Vector V size(V)=n*1
in the fist colomn of M we find some indexes of V I want to extract the indexes of V which are not used in M.
is that possible?
thank you

채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 11월 14일
ismember function might be helpful.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2011년 11월 14일
Much more directly:
setdiff(V, M(:,1))

Fatma Gargouri
Fatma Gargouri 2011년 11월 14일
thank you Grzegorz Knor
K=M(:,1);
p=1;
for i=1:size(V,1)
ind=ismember(i,K);
if ind==0
R(p)=i;
p=p+1;
end
end

카테고리

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