Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
addtodate irreversible behavior

Subject: addtodate irreversible behavior

From: Le Fou Volant

Date: 17 May, 2011 23:50:44

Message: 1 of 2

Hello,

I am leaning toward saying the addtodate does not work,
but maybe I am doing something wrong:

t0 = datenum('01-Jan-2000', 'dd-mmm-yyyy');
addtodate( addtodate(t0, 0, 'day'), -t0, 'day')

gives 2!!!
It should be zero.

I observe this behavior for any number, i.e. not just when
I add 0.

Does anyone know how to coerce addtodate to behave
properly?

Subject: addtodate irreversible behavior

From: Steven_Lord

Date: 19 May, 2011 14:13:41

Message: 2 of 2



"Le Fou Volant" <alexaguillaume@gmail.com> wrote in message
news:023d0963-bd0a-47b5-9be7-ed5019be29b2@18g2000prd.googlegroups.com...
> Hello,
>
> I am leaning toward saying the addtodate does not work,
> but maybe I am doing something wrong:
>
> t0 = datenum('01-Jan-2000', 'dd-mmm-yyyy');
> addtodate( addtodate(t0, 0, 'day'), -t0, 'day')
>
> gives 2!!!
> It should be zero.
>
> I observe this behavior for any number, i.e. not just when
> I add 0.
>
> Does anyone know how to coerce addtodate to behave
> properly?

I have forwarded this issue to the developers responsible for ADDTODATE for
investigation.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us