Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Timeseries function duplicate records error
Date: Thu, 29 Oct 2009 20:29:03 +0000 (UTC)
Organization: Trent University
Lines: 28
Message-ID: <hcctuf$e23$1@fred.mathworks.com>
References: <hcco6n$a0p$1@fred.mathworks.com> <5b388161-e844-4448-ae52-b6ce29dab679@y32g2000prd.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256848143 14403 172.30.248.38 (29 Oct 2009 20:29:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 29 Oct 2009 20:29:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1540233
Xref: news.mathworks.com comp.soft-sys.matlab:581136


NZTideMan <mulgor@gmail.com> wrote in message <5b388161-e844-4448-ae52-b6ce29dab679@y32g2000prd.googlegroups.com>...
> On Oct 30, 7:51?am, "Bastian "
> <bastianschm...@trentu.removethistext.ca> wrote:
> > When I try to create a new timeseries object using the following code (read frmo a text file): ?
> >
> > ? ? DateTime = FileContent{1,1}; %example: 07/30/07 15:32:35.0
> > ? ? Temp = FileContent{1,2}; %example: 24.605
> > ? ? ts = timeseries(Temp,DateTime);
> >
> > I get the following warning and error:
> >
> > ? ?Warning: Duplicate records are detected and have been merged.
> > ? ???? Error using ==> timeseries.init at 312
> > ? ?Mismatch between the size of the data and the quality properties.
> > ? ?Error in ==> timeseries.timeseries>timeseries.timeseries at 216
> > ? ? ? ? ? ? ? ? ? this = init(this,varargin{:});
> > ? ?Error in ==> ThermoSTATv2_Oct29_2009>pbtReadFile_Callback at 125
> > ? ? ts = timeseries(Temp,DateTime);
> >
> > It looks like MATLAB has detected a duplicate record and has "fixed" the problem by "merging" the records. Then something happens that some other part of the timeseries function does not like because of the previous "fix". Does anybody have any clever ideas on how to prevent this from happening? or some sort of work around?
> 
> Before going into timeseries, use the function unique on DateTime to
> remove duplications of time.  You will also need to eliminate the
> corresponding rows in Temp:
> [DateTimeNew,indx]=unique(DateTime);
> TempNew=Temp(indx);

Thanks, that's done it. I had been trying to make use of the "unique" function but was stumped by the fact that it sorts the output. I now realize that this does not matter since timeseries puts the times back in order automatically! Thanks again for your help.