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!