Path: news.mathworks.com!not-for-mail
From: "Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Date and time handling question...
Date: Fri, 12 Jun 2009 10:23:01 +0000 (UTC)
Organization: Tampere University of Technology
Lines: 27
Message-ID: <h0taa5$ff1$1@fred.mathworks.com>
References: <h0t7lq$t1i$1@fred.mathworks.com> <h0t8lm$2dg$1@fred.mathworks.com>
Reply-To: "Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244802181 15841 172.30.248.37 (12 Jun 2009 10:23:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 12 Jun 2009 10:23:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 218565
Xref: news.mathworks.com comp.soft-sys.matlab:546833


"Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi> wrote in message <h0t8lm$2dg$1@fred.mathworks.com>...
> "Andrey Kazak" <AK@nospam.ru> wrote in message <h0t7lq$t1i$1@fred.mathworks.com>...
> > Greetings!
> > 
> > I have a csv file as follows:
> > ===
> > Date and Time, Value,
> > 08.06.2009 16:16:26, 3
> > ...
> > ===
> > Could you advice me please on how to import such time series in matlab for further processing, such as time interpolation please?
> > 
> > Prompt and clear reply would be very much appreciated...
> 
> doc textscan
> doc datenum
> 
> This for example seems to work:
> fid = fopen('myfile.csv');
> g = textscan(fid,'%s%f','headerlines',1,'delimiter',',');
> fclose(fid);
> time = datenum(g{1});

Oops, wasn't carefun enough with the date format, this should do it
time = datenum(g{1},'dd.mm.yyyy HH:MM:SS');
or if you use month.day.year, swap the dd and mm in the format string
hth