MATLAB: Subtracting numbers from a date serial

substract one

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);

Best Answer

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