Weighted Counts of Vectors

4 visualizzazioni (ultimi 30 giorni)
SJ B
SJ B il 25 Apr 2018
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!

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by