How to average array into bins (bin-averaging)

I have two arrays which I need to be the same size for further analysis. One is sediment concentration with depth, where "conc" is 253x2006 (253 depths and 2006 time points). The other is water velocity with depth, where "vel" is 6x2006 (6 depths and same 2006 time points). The depths for "vel" have a coarser resolution but they all fall within the range of the 253 finer-res depths for "conc". My problem has been trying to bin-average the concentration data to the bins of the velocity data. In other words I want to average "conc" to the same 6 bin values as "vel", with each bin centered on the original 6 depth values of "vel".
Any thoughts on how to approach this would be much appreciated! Let me know if further information is needed.

2 comentarios

Matt J
Matt J el 29 de Jul. de 2017
But 6 does not divide evenly into 253. Is that the problem?
Kevin Simans
Kevin Simans el 3 de Ag. de 2017
That was definitely part of it. A simple oversight on my part. Thanks!

Iniciar sesión para comentar.

Respuestas (1)

Matt J
Matt J el 29 de Jul. de 2017
Editada: Matt J el 29 de Jul. de 2017
Assuming it's a typo that conc doesn't divide evenly into 6 bins, then you could use SEPBLOCKFUN ( Download), e.g.
>> A=sepblockfun( rand(300,2006) , [50,1], @mean); Whos A
Name Size Kilobytes Class Attributes
A 6x2006 95 double

Categorías

Preguntada:

el 28 de Jul. de 2017

Comentada:

el 3 de Ag. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by