How do I determine if a value is unique within an iteration?
이전 댓글 표시
I have an array nuc. During an iteration from i:some value, If nuc(1,i) is unique, I want to proceed. In other words, when i is generated, and nuc(1,i) is determined, if it is the only one of that value in nuc, then...
채택된 답변
추가 답변 (1개)
Jos (10584)
2014년 3월 27일
Doe the array nut changes during iterations? If not, you can find the unique indices into nut using UNIQUE
[~,idx] = unique(nuc)
for i=idx
disp(i) ;
end
Otherwise
for i=1:N,
if sum(nuc==nuc(i))==1,
disp(i) ;
end
end
카테고리
도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!