"Michael " <firstname.lastname@example.org> wrote in message <email@example.com>... > "Bizuayehu Mohammed" <firstname.lastname@example.org> wrote in message <email@example.com>... > > "Jos " <#firstname.lastname@example.org> wrote in message <email@example.com>... > > > "Bizuayehu Mohammed" <firstname.lastname@example.org> wrote in message <email@example.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.