Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: import uneven data file
Date: Fri, 23 May 2008 13:28:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 43
Message-ID: <g16gp1$f5l$1@fred.mathworks.com>
References: <7282774.1211548249862.JavaMail.jakarta@nitrogen.mathforum.org>
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 1211549281 15541 172.30.248.35 (23 May 2008 13:28:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 23 May 2008 13:28:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:470038



AMK <kennaster@gmail.com> wrote in message
<7282774.1211548249862.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hi,
> I would like to import a comma delimited file that takes
the form:
> 
> file1:
> 115,1,2,3,4,5
> 101,1,2,3,4,5,6,7,8,9
> 
> Does a matlab command exist to do this?


D1 = textread('data.txt','%f','delimiter',',')


> 
> ie. convert on-the-fly to this so the workspace can handle it?
> 115,1,2,3,4,5,nan,nan,nan,nan
> 101,1,2,3,4,5,6,7,8,9


D2 =  load('data.txt')


> 
> Then create a variable of just the 115 rows and a variable
of just the 101 rows?
> 
> x1 = 115,1,2,3,4,5,
> x2 = 101,1,2,3,4,5,6,7,8,9
> 


D1 will not be trivial.
D2 will be relatively easy:

q = isnan(D2) ;
x1 = D2(1,q(1,:)) 
x2 = ...

hth
Jos