MATLAB Accumarray weighted mean

前端 未结 4 1348
傲寒
傲寒 2020-12-17 02:06

So I am currently using \'accumarray\' to find the averages of a range of numbers wich correspond to matching ID\'s. Ex Input:

ID----Value
1     215
1     33         


        
4条回答
  •  猫巷女王i
    2020-12-17 02:28

    What you are trying to compute is not a weighted mean, but rather a weighted histogram.
    There is a mex implementation of weighted histogram that can be found here. Though, accumarray is the safe way to go about.

提交回复
热议问题