Path: news.mathworks.com!not-for-mail
From: "Leslie McBrayer" <lmcbrayer@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to import timestamp (5:48:05 ) to a format ML can handle
Date: Wed, 7 Oct 2009 13:43:06 -0400
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <haijvc$6pq$1@fred.mathworks.com>
References: <1213675765.22507.1254859042177.JavaMail.root@gallium.mathforum.org> <655747749.23145.1254868782259.JavaMail.root@gallium.mathforum.org>
Reply-To: "Leslie McBrayer" <lmcbrayer@mathworks.com>
NNTP-Posting-Host: mcbrayerl.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1254937388 6970 172.31.45.140 (7 Oct 2009 17:43:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 Oct 2009 17:43:08 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Xref: news.mathworks.com comp.soft-sys.matlab:575665



"AMK" <kennaster@gmail.com> wrote in message 
news:655747749.23145.1254868782259.JavaMail.root@gallium.mathforum.org...
> This:
>
> [code]
> for n = 1:length(fnames)    %Start the for loop for the file names
>  ch4_dt(n,:) = dlmread(fnames(n).name, '\t', datenum([dr1 dc1 dr2 dc2]))'; 
> %Read in the data
>  %timestamp(n,:) = dlmread(fnames(n).name, ';', [tr1 tc1 tr2 tc2])'; 
> %Read in the timestamps
> end %End the loop
> [/code]
>
> only gets me a 5, which is the first value in the timestamp shown in the 
> original problem.

The dlmread function cannot read formatted dates and times.  Consider using 
textscan to read the dates/times in as strings (type "doc textscan" at the 
command prompt for more info).  Then you can convert the strings to numbers 
using datenum.