how to count the number of element in observation and make summation?

조회 수: 3 (최근 30일)
c b a 110
a d a 1551
a b b 502
a b c 179
d b a 124
For the observations given above, I want to count the number of elements in individual observations
and want to divide the value of the 4th column proportionally, according to the number of element in the same row.
For example, for above example, I want to give a=110/3+ 1551*2/3+502/3+179/3+124/3.
Does anyone know how to compute this in matlab?
For your reference, I will attach my .mat file.
Thank you.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 4월 18일
K = B.TotalRevenue.*ones(size(B,1),3)/3;
[a1,~,c1] = unique(B{:,1:3});
out = table(a1,accumarray(c1,K(:)),'v',{'opals','Revenue'});

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Automotive에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by