how can i add 1-40,41-80, 81-120 and so on till 14000 datapoints which is in a text file?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ruby
le 13 Fév 2014
Modifié(e) : Walter Roberson
le 15 Fév 2014
sir....i have a text file which consist of 14000 rows and 2 columns.... i have to add the 40 points each till 14000 data... means 1-40 , 41-80, 81-120 and so on... what should i do for that???
0 commentaires
Réponse acceptée
Walter Roberson
le 13 Fév 2014
You have two columns, so
squeeze( sum( reshape(YourData, 40, [], 2) ) )
7 commentaires
Plus de réponses (1)
Jos (10584)
le 13 Fév 2014
In cases when the total number of elements is not divisible by the size of the smaller groups, and reshape cannot be used, this trick with accumarray may be useful:
V = 1:10 ;
n = 3 ;
rem(numel(V),n) % :-(
ix = floor((0:numel(V)-1)/3) ;
R = accumarray(ix, V ,@sum)
0 commentaires
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!