Prev: Robust control
Next: Area inside a closed curve
From: Judy on 2 Aug 2010 05:39 Hi folks, Is there an easy way to add a relative time to a datenum serial date/time number so that you get that future datenum serial/time number out? For ex: Real time: 7/23/2010 23:12:23 Relative time: 56 hrs 23 minutes 26 seconds Real time + relative time = ? I think the hard part is writing out the relative time out, i.e. given 56 hrs 23 minutes and 26 seconds to get a "real" date that I can easily put into the datenum function. Is there anything in matlab that can do this calculation for me or do I need to do this manually? Thanks!
From: Ross W on 2 Aug 2010 06:15 "Judy " <sauwen.jl(a)gmail.com> wrote in message <i363nq$op7$1(a)fred.mathworks.com>... > Hi folks, > > Is there an easy way to add a relative time to a datenum serial date/time number so that you get that future datenum serial/time number out? > > For ex: > Real time: 7/23/2010 23:12:23 > Relative time: 56 hrs 23 minutes 26 seconds > Real time + relative time = ? > > I think the hard part is writing out the relative time out, i.e. given 56 hrs 23 minutes and 26 seconds to get a "real" date that I can easily put into the datenum function. Is there anything in matlab that can do this calculation for me or do I need to do this manually? > > Thanks! Hi How about datenum(Realtime)+datenum(2010,1,1,56,23,10)-datenum(2010,1,1,0,0,0) Ross
From: us on 2 Aug 2010 06:17 "Judy " <sauwen.jl(a)gmail.com> wrote in message <i363nq$op7$1(a)fred.mathworks.com>... > Hi folks, > > Is there an easy way to add a relative time to a datenum serial date/time number so that you get that future datenum serial/time number out? > > For ex: > Real time: 7/23/2010 23:12:23 > Relative time: 56 hrs 23 minutes 26 seconds > Real time + relative time = ? > > I think the hard part is writing out the relative time out, i.e. given 56 hrs 23 minutes and 26 seconds to get a "real" date that I can easily put into the datenum function. Is there anything in matlab that can do this calculation for me or do I need to do this manually? > > Thanks! one of the solutions do='02-aug-2010 12:30:30'; % <- a date... d=datenum(do); dn=datestr(d+1) % <= +1 day % dn = 03-Aug-2010 12:30:30 dn=datestr(d+1/24) % <= +1 hour % dn = 02-Aug-2010 13:30:30 us
From: Judy on 2 Aug 2010 13:53 "us " <us(a)neurol.unizh.ch> wrote in message <i365vk$f5u$1(a)fred.mathworks.com>... > "Judy " <sauwen.jl(a)gmail.com> wrote in message <i363nq$op7$1(a)fred.mathworks.com>... > > Hi folks, > > > > Is there an easy way to add a relative time to a datenum serial date/time number so that you get that future datenum serial/time number out? > > > > For ex: > > Real time: 7/23/2010 23:12:23 > > Relative time: 56 hrs 23 minutes 26 seconds > > Real time + relative time = ? > > > > I think the hard part is writing out the relative time out, i.e. given 56 hrs 23 minutes and 26 seconds to get a "real" date that I can easily put into the datenum function. Is there anything in matlab that can do this calculation for me or do I need to do this manually? > > > > Thanks! > > one of the solutions > > do='02-aug-2010 12:30:30'; % <- a date... > d=datenum(do); > dn=datestr(d+1) % <= +1 day > % dn = 03-Aug-2010 12:30:30 > dn=datestr(d+1/24) % <= +1 hour > % dn = 02-Aug-2010 13:30:30 > > us Got it. Thanks for the help, us & Ross.
From: Steven_Lord on 3 Aug 2010 10:12
"Judy " <sauwen.jl(a)gmail.com> wrote in message news:i363nq$op7$1(a)fred.mathworks.com... > Hi folks, > > Is there an easy way to add a relative time to a datenum serial date/time > number so that you get that future datenum serial/time number out? > > For ex: > Real time: 7/23/2010 23:12:23 > Relative time: 56 hrs 23 minutes 26 seconds > Real time + relative time = ? > > I think the hard part is writing out the relative time out, i.e. given 56 > hrs 23 minutes and 26 seconds to get a "real" date that I can easily put > into the datenum function. Is there anything in matlab that can do this > calculation for me or do I need to do this manually? > > Thanks! Look at the ADDTODATE function. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com |