Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: reading a data file to searches on Date
Date: Sat, 4 Oct 2008 19:40:04 +0000 (UTC)
Organization: Pierburg GmbH
Lines: 23
Message-ID: <gc8gqk$49v$1@fred.mathworks.com>
References: <gc7qv5$pv0$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1223149204 4415 172.30.248.37 (4 Oct 2008 19:40:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 4 Oct 2008 19:40:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872224
Xref: news.mathworks.com comp.soft-sys.matlab:493628


"John Smith" <cc200802@yahoo.com> wrote in message <gc7qv5$pv0$1@fred.mathworks.com>...
> Hi,
>  I wanted to read in a file with the following format
> 
> Date  number number 
> 
> where date is a string such as "4-Oct-08" and numbers are floating point.
> 
>  I want to be able to do some searches (using find) on the Date. How do I read in the file such that I can do the searches on the date ?

Hi John,
use textscan to read in the data, i.e. something like

fname = 'c:\jsmith.txt';
fid = fopen(fname);
A = textscan(fid, '%s %f %f');
fclose(fid);

and if necessary apply one of the date functions (like datevec) to the first element of A (which stores the date strings in a cell array of strings). The respective doc pages will give you more insight into this.
I hope this gets you started.
Regards
Andres