Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: reading a data file to searches on Date
Date: Sun, 5 Oct 2008 15:05:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 51
Message-ID: <gcal2u$aci$1@fred.mathworks.com>
References: <gc7qv5$pv0$1@fred.mathworks.com> <gc8gqk$49v$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1223219102 10642 172.30.248.35 (5 Oct 2008 15:05:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 5 Oct 2008 15:05:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1538001
Xref: news.mathworks.com comp.soft-sys.matlab:493702


Thanks again for your help. I'm still strugling to achieve what I want. I'm not able to read the data and when I can see that I've read all the data into cell arrays.

for example, i see

when I print A, where A=textscan(fid, '%s %f %f');
    {1202x1 cell}    [1202x1 double]    [1202x1 double]

I now want to do something like
IDX = find(A{1} == '05-Sep-08') 
it gives me error, 


??? Undefined function or method 'eq' for input arguments of type 'cell'.

so I tried 
IDX = find(datevec(A{1} == datevec(05-Sep-08'))

??? Error using ==> eq
Matrix dimensions must agree.

 
appreciate any help 

Thank you.

John

"Andres " <rantore@werb.deNoRs> wrote in message <gc8gqk$49v$1@fred.mathworks.com>...
> "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