Effacer les filtres
Effacer les filtres

subtracting numbers from a date serial

1 vue (au cours des 30 derniers jours)
AA
AA le 7 Nov 2015
Modifié(e) : Stephen23 le 7 Nov 2015
suppose i have a matrix with the following numbers
736274
736273
736246
736245
736211
736210
736183
736182
i want to turn the above into the following
736274
736273
736272
736246
736245
736244
736211
736210
736209
736183
736182
736181
how can i do this? with the formula below i can only substract by one but i want to substract by one and two
result = reshape([date_num.'; date_num.'-1], [], 1);

Réponse acceptée

Star Strider
Star Strider le 7 Nov 2015
It takes three lines, not one, but you’re close:
result = reshape(date_num, 2, []);
result = [result; result(end,:)-1];
result = result(:)
result =
736274
736273
736272
736246
736245
736244
736211
736210
736209
736183
736182
736181

Plus de réponses (0)

Catégories

En savoir plus sur Clocks and Timers 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!

Translated by