Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!ecngs!feeder2.ecngs.de!feeder.erje.net!aioe.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: subtracting time difference
Date: Sat, 11 Aug 2007 08:37:12 -0500
Organization: Aioe.org NNTP Server
Lines: 33
Message-ID: <f9ke6c$fcs$1@aioe.org>
References: <f9jh3u$dnm$1@fred.mathworks.com>
NNTP-Posting-Host: G/L+1vXWjgmrKujSrYa/wQ.user.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
Xref: news.mathworks.com comp.soft-sys.matlab:423523


jason wrote:
> hi 
> 
> i have some data that i am recording the time that it enters
> the serial port. it is currently been written to a file, but
> i would also like to find the difference in time between the
> sequences of data.
> 
> the data is stored in the file like this:
> 
> 4f   09.22.569
> 63   09.22.588
> 67   09.22.613   
> 
> with the first part being hex data and the second part is
> the time stamp using datestr(now('MM.SS.FFF'));
> 
> how do i set it up so that it finds the difference in time
> between 09.22.588 and 09.22.613? it cant be changed using
> datenum because datenum doesnt recognise SS.FFF.

Write your own function to handle the format you have.

All you need basically is 1000*(MM*60 + SS) + FFF for each numbers 
(scaling to integers) for each number and then take the difference and 
reverse the scaling.

Or, if not concerned about the minor amount of floating point roundoff 
you could forget the scaling by 1000

timestampserial == MM*60 + SS.FFF

--