필터 지우기
필터 지우기

How can i find an eleiment which comes only one in a matrix ?????

조회 수: 1 (최근 30일)
raj singh
raj singh 2016년 6월 22일
답변: Jos (10584) 2016년 6월 24일
Example
A=[1 2;1 3;1 4;1 5;2 4]
Ans should be [3 5]

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 6월 22일
편집: Azzi Abdelmalek 2016년 6월 22일
A=[1 2;1 3;1 4;1 5;2 4]
[ii,jj,kk]=unique(A)
b=accumarray(kk,(1:numel(kk))',[],@numel)
out=ii(b==1)

추가 답변 (1개)

Jos (10584)
Jos (10584) 2016년 6월 24일
When A only contains positive integers:
A = [1 2 3 1 2 4 1 2 4 5]
B = find(sparse(A(:),1,1)==1)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by