Help me, please. I want a matrix transform averaged and unique in specific col,
조회 수: 1 (최근 30일)
이전 댓글 표시
I want first 1 and 2 columns unique and 3 coloum make average matrix.
for example
[1,2,11; 1,2,12; 1,2,13; 2,4,10; 2,4,12]
->
[1,2,12; 2,4,10]
How can I get that? I can do that very complex way but I think there is some smart way. Help me people
댓글 수: 2
채택된 답변
Andrei Bobrov
2011년 10월 20일
A = [1,2,11; 1,2,12; 1,2,13; 2,4,10; 2,4,12];
[a,b,c] = unique(A(:,1:2),'rows');
out = [a cellfun(@mean,mat2cell(A(:,end),histc(c,1:max(c)),1))];
추가 답변 (1개)
Pramod Bhat
2011년 10월 20일
may u please elaborate your question? im not getting ur problem...
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!