Minimum of unique values
이전 댓글 표시
I am trying to find the minimum of vector y=[ 1 2 4 3 9 7] which corresponds to vector x= [100 100 200 200 300 300] so that the result is z=[1 3 7]
what I need is the minimum of each unique x value.
채택된 답변
추가 답변 (2개)
Andrei Bobrov
2016년 3월 9일
[~,~,c] = unique(x);
z = accumarray(c(:),y(:),[],@min);
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!