Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
|
Re: datestr
Posted:
Jun 12, 2009 4:05 AM
|
|
"Michael " <mmorris@firstwind.com> wrote in message <h0oor2$pjk$1@fred.mathworks.com>... > "Bizuayehu Mohammed" <bisaye@gmail.com> wrote in message <h0nk8i$739$1@fred.mathworks.com>... > > "Jos " <#10584@fileexchange.com> wrote in message <h0lgmm$rqq$1@fred.mathworks.com>... > > > "Bizuayehu Mohammed" <bisaye@gmail.com> wrote in message <h0lcla$8fq$1@fred.mathworks.com>... > > > > Hi > > > > I want to write a code that counts back 15 seconds in one second interval from current time,i.e from now. > > > > I would appreciate any help > > > > > > help clock > > > help while > > > help etime > > > > > > % Example: > > > t0 = clock ; > > > while etime(clock,t0) < 1, > > > end > > > disp('Elapsed time:') ; > > > disp(etime(clock,t0)) > > > > > > hth > > > Jos > > Thanks but what I want is to plot a real time graph using this time that means I want the exact time value as HH:MM:SS in each interval for example 10:44:32 is the real time I want to have the values 10:44:31,10:44:30,10:44:29,10:44:28 ...etc till 15 seconds. > > Many Thanks > > cellstr(datestr(datenum(now) - [1:15]/86400, 'mm/dd/yyyy HH:MM:SS')) > > That gives you the mm/dd/yyyy HH:MM:SS formatted times from the last 15 seconds. It's up to you to manipulate what I've done from there to turn it into something you can use to plot, as a cell array of strings is not a valid independent variable. way way better than the code I wrote thanks a lot.
|
|
|
|