How do I measure mean of every 10 data of a vector size 1x1500?
Mostra commenti meno recenti
I have a vector of size 1x1500, whose every 10 values, are of one person (i.e, there are 150 persons).
I should estimate the mean of those 10 values for each person. my script is not working well, any idea?
Risposta accettata
Più risposte (2)
Jan de Wilde
il 29 Mag 2014
2 voti
Avoiding loops , try:
A = rand(1,1500); % your data
M = mean( reshape( A, 10, 150 ) );
1 Commento
Klara
il 29 Mag 2014
Jos (10584)
il 29 Mag 2014
% DATA
A = rand(1,1500) ;
N = 10 ;
% ENGINE
M = accumarray((floor((0:numel(A)-1)/N)+1).',A(:),[],@mean) ;
% CHECK
k = 17 ;
isequal(M(k),mean(A(((k-1)*N)+(1:10))))
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!