sum in sequence, string, matrix

10 vues (au cours des 30 derniers jours)
Nikola Ostojic
Nikola Ostojic le 16 Jan 2021
Commenté : Star Strider le 16 Jan 2021
I have a 1x8760 matrix (hours per year). I need to add up 24h and make a 1x365 or 365x1 matrix.
example: sum of values ​​1-24 in 1x1
sum of values ​​25-48 in 1x2 ..

Réponse acceptée

Star Strider
Star Strider le 16 Jan 2021
Try this:
M = 1:8760; % Create Vector
Mr = reshape(M, 24, []); % Reshape Vector
MeanMr = mean(Mr); % Take Column Means
.
  3 commentaires
Star Strider
Star Strider le 16 Jan 2021
Sorry. I misread your Question. Replace mean with sum. They operate the same way.
Star Strider
Star Strider le 16 Jan 2021
As always,. my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by