Filter löschen
Filter löschen

I have an array of 1000 elements I need to do average of 100 elements so that my new array is of 10 elements...

3 Ansichten (letzte 30 Tage)
I have an array of 1000 elements I need to do average of 100 elements so that my new array is of 10 elements...

Antworten (1)

Guillaume
Guillaume am 21 Mär. 2017
reshape your array into 100 rows, take the mean across these 100 rows:
assert(mod(numel(yourarray), 100) == 0, 'number of elements is not a multiple of 100')
mean(reshape(yourarray, 100, []))

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by