Calculate median values of slices of array associated with histogram bins
Ältere Kommentare anzeigen
I have an array (array1) which I want to put into histogram bins. I have a second array (array2) which is the same length.
I can sum the values of array2 in each bin with this:
[count, edges, idx] = histcounts(array1,edges);
binsums = accumarray(idx,array2);
But how can I calculate the median values of array2 in each bin?
Akzeptierte Antwort
Weitere Antworten (1)
Steven Lord
am 15 Nov. 2023
0 Stimmen
If all you want is the bin numbers, you could also use the discretize function instead of histcounts.
1 Kommentar
dormant
am 15 Nov. 2023
Kategorien
Mehr zu Histograms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!