How can I calculate the cumulative sum of this file?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everyone,
I should calculate the cumulate of the column 4, from 2015 until 2020. How can I do it?
Thank you!
0 commentaires
Réponse acceptée
Steven Lord
le 1 Déc 2021
"calculate the cumulative" what of the file?
Cumulative sum? cumsum.
Cumulative product? cumprod.
Cumulative minimum or maximum? cummin and cummax.
5 commentaires
Steven Lord
le 2 Déc 2021
Can you show:
whos DATIECMWFgiornalieri
I'm assuming the comma inside the cumsum call is a typo, as otherwise that code would have thrown an error.
If I'm right and DATIECMWFgiornalieri is a table or timetable array, extract the contents of the fourth variable using curly braces instead of extracting the fourth variable as a sub-table using parentheses.
load patients
T = table(LastName, Height, Weight, Age);
head(T) % Show only the first few rows
C1 = cumsum(T{:, 4}) % Cumulative sum of the Age variable
C2 = cumsum(T(:, 4)) % Will error as cumsum is not defined for table arrays
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical 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!