From: Karan on
hi lorenzo

Mailed u a copy as well

but here it goes

733283
733283
733283
733283
733283
733283.0001
733283.0001
733283.0001
733283.0001
733283.0001
733283.0001
733283.0001
733283.0001
733283.0002
733283.0002
733283.0002
733283.0002
733283.0002
733283.0002
733283.0002
733283.0002
733283.0002
733283.0003
733283.0003
733283.0003
733283.0003
733283.0003
733283.0003
733283.0003
733283.0003
733283.0003
733283.0004
733283.0004
733283.0004
733283.0004
733283.0004
733283.0004
733283.0004
733283.0004
733283.0005
733283.0005
733283.0005
733283.0005
733283.0005
733283.0005
733283.0005
733283.0005
733283.0005
733283.0006
733283.0006
733283.0006
733283.0006
733283.0006
733283.0006
733283.0006
733283.0006
733283.0006
733283.0007
733283.0007
733283.0007
733283.0007
733283.0007
733283.0007
733283.0007
733283.0007
733283.0008
733283.0008
733283.0008
733283.0008
733283.0008
733283.0008
733283.0008
733283.0008
733283.0008
733283.0009
733283.0009
733283.0009


"Lorenzo " <lorenz4matlab(a)gmail.com> wrote in message
<fbc9hn$67j$1(a)fred.mathworks.com>...
> Can you post (part of) your initial data?
>

From: Walter Roberson on
In article <fbc1rh$6n$1(a)fred.mathworks.com>,
Karan <ksumbaly(a)hotmail.com> wrote:

>Have a huge vector of serial date time and i wish to
>compute the difference between each element of the vector
>with the next element. Basically the pseudo command is
>something like this

>find(diff(serial_Time_vector)>1800 seconds)

>I wish to find the index numbers in the vector where the
>difference is greater than 30 minutes. Whats the quickest
>way to do this?

thirtyserialmins = 30./60./24. %fraction of a day

find(diff(serial_Time_vector) > thirtyserialmins)


As long as you don't change the pivot date/time somewhere along
the vector ;-)
--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton
From: Lorenzo on
"Karan " <ksumbaly(a)hotmail.com> wrote in message
<fbdico$a9b$1(a)fred.mathworks.com>...
> hi lorenzo
>
> Mailed u a copy as well
>
> but here it goes
>
> 733283
> 733283
<snip>
> 733283.0009
>
>
> "Lorenzo " <lorenz4matlab(a)gmail.com> wrote in message
> <fbc9hn$67j$1(a)fred.mathworks.com>...
> > Can you post (part of) your initial data?
> >
>

Ok... from the Matlab documentation and these numbers, I gather that this is
an array of values in "Serial Date Number" format, which "represents the
whole and fractional number of days from a specific date and time, where
datenum('Jan-1-0000 00:00:00') returns the number 1". (from the help page
for datenum).
So, basically, these numbers are the *days* from "beginning of time".
Let's call Time the vector you posted. It can be transformed in seconds using
this code:

secsInADay = 24*3600; % seconds in a day
Time_days = Time - Time(1); % first element is the zero time
Time_sec = Time_days * secsInADay;

It turns out that the file you emailed me represents 24 hrs sampled at 1
second. Is this correct? If it is, then the code above is correct and your
original problem would be solved by

find( diff(Time_sec) > 1800 )

Lorenzo
From: Karan on
Thanks Lorenzo

I actually took an easy way out. Its not foolproof but hey
it works

start_time = datevec(startTime);
start_time = start_time(:,6)+start_time(:,5)
*60+start_time(:,4)...
*3600+start_time(:,3)*24*3600;


"Lorenzo " <lorenz4matlab(a)gmail.com> wrote in message
<fbejiv$gef$1(a)fred.mathworks.com>...
> "Karan " <ksumbaly(a)hotmail.com> wrote in message
> <fbdico$a9b$1(a)fred.mathworks.com>...
> > hi lorenzo
> >
> > Mailed u a copy as well
> >
> > but here it goes
> >
> > 733283
> > 733283
> <snip>
> > 733283.0009
> >
> >
> > "Lorenzo " <lorenz4matlab(a)gmail.com> wrote in message
> > <fbc9hn$67j$1(a)fred.mathworks.com>...
> > > Can you post (part of) your initial data?
> > >
> >
>
> Ok... from the Matlab documentation and these numbers, I
gather that this is
> an array of values in "Serial Date Number" format,
which "represents the
> whole and fractional number of days from a specific date
and time, where
> datenum('Jan-1-0000 00:00:00') returns the number 1".
(from the help page
> for datenum).
> So, basically, these numbers are the *days*
from "beginning of time".
> Let's call Time the vector you posted. It can be
transformed in seconds using
> this code:
>
> secsInADay = 24*3600; % seconds in a day
> Time_days = Time - Time(1); % first element is the zero
time
> Time_sec = Time_days * secsInADay;
>
> It turns out that the file you emailed me represents 24
hrs sampled at 1
> second. Is this correct? If it is, then the code above is
correct and your
> original problem would be solved by
>
> find( diff(Time_sec) > 1800 )
>
> Lorenzo

From: us on
Karan:
<SNIP where's the time warp...

one of the solutions

% create some sorted dates
ds=[
datestr(now:now+5)
datestr(now+21:now+25)
];
% the engine
% ...use <datenum>
dn=datenum(ds);
ix=find(diff(dn)>10);
% the result, eg,
ds(ix-1:ix,:)

us