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