Weighted Counts of Vectors

2 次查看(过去 30 天)
SJ B
SJ B 2018-4-25
Hi, I have a vector of x,y coordinates each with weights. I want to bin the (x,y) coordinates per some general xedges and yedges but also include the weights for each of these coordinates. Here's a simple example with an attempt- I'm not sure how to incorporate the weights:
matrix=[randi(11,1,5); randi(11,1,5).*0.75; [0.5 1 1 2 0.5]];
xedge=0:5:round(max(init)/5)*5;
yedge=xedge;
counts=histcounts2(matrix(1,:),matrix(2,:),xedge,yedge);
This is able to bin and weight each coordinate equally instead of with 0.5 for the first coordinate, 1 for the second coordinate, etc. I was wondering how I could do the bin and weighting efficiently with large matrices with three rows (x,y coordinates and weights).
Thanks!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by