Path: news.mathworks.com!not-for-mail
From: "Dan Haeg" <haegd@msoe.edu>
Newsgroups: comp.soft-sys.matlab
Subject: read the first line from a csv file of unknown length
Date: Fri, 16 Nov 2007 18:20:23 +0000 (UTC)
Organization: Milwaukee School of Engineering
Lines: 31
Message-ID: <fhkn17$jcd$1@fred.mathworks.com>
References: <fhkgvh$oor$1@fred.mathworks.com>
Reply-To: "Dan Haeg" <haegd@msoe.edu>
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 1195237223 19853 172.30.248.38 (16 Nov 2007 18:20:23 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 16 Nov 2007 18:20:23 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 475291
Xref: news.mathworks.com comp.soft-sys.matlab:437974



"Philip Gladwin" <philip.gladwin@citi.com> wrote in message
<fhkgvh$oor$1@fred.mathworks.com>...
> Hello,
> Does anybody know how to solve this problem?
> 
> I would like to read the column headings, as strings, 
> from the first row of a comma-separated file into
> an string array.
> 
> The tricky part is I would like to do this without
> specifying the number of columns in the file, as
> the column headings will change from file to file.
> 
> Can anybody help?
> 
> Thank you.
> 
> Phil,
> 
> 
> 
> 
> 
> 
This may work:
h = actxserver('Scripting.FileSystemObject');
ts=h.OpenTextFile(filename);
headings=ts.ReadLine;

Dan