Filter löschen
Filter löschen

subtracting numbers from a date serial

1 Ansicht (letzte 30 Tage)
AA
AA am 7 Nov. 2015
Bearbeitet: Stephen23 am 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);

Akzeptierte Antwort

Star Strider
Star Strider am 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

Weitere Antworten (0)

Kategorien

Mehr zu Clocks and Timers finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by