subtracting numbers from a date serial

1 view (last 30 days)
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);

Accepted Answer

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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!