How can i find an eleiment which comes only one in a matrix ?????
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
raj singh
am 22 Jun. 2016
Beantwortet: Jos (10584)
am 24 Jun. 2016
Example
A=[1 2;1 3;1 4;1 5;2 4]
Ans should be [3 5]
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 22 Jun. 2016
Bearbeitet: Azzi Abdelmalek
am 22 Jun. 2016
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 Kommentar
Weitere Antworten (1)
Jos (10584)
am 24 Jun. 2016
When A only contains positive integers:
A = [1 2 3 1 2 4 1 2 4 5]
B = find(sparse(A(:),1,1)==1)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!