Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Can you do this with load?
Date: Tue, 27 May 2008 13:21:01 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 28
Message-ID: <g1h1rt$2mg$1@fred.mathworks.com>
References: <g1h11m$mm6$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 1211894461 2768 172.30.248.37 (27 May 2008 13:21:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 27 May 2008 13:21:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:470601



"David Doria":
<SNIP simple text reader...

> I have a file like this
> 1 2 3
> 1 2 3 4 5 6
> 1 2 3 4 5 6
> 1 2 3 4 5 6
> 1 2 3 4 5 6

one of the solutions

     fnam='foo.txt'; % your file name...
     nc=6;
     fmt=repmat('%n',1,nc);
     clear m;
     [m{1:nc}]=textread(fnam,fmt,'emptyvalue',nan);
     m=cat(2,m{:});
     disp(m)
%{
     1   2   3 NaN NaN NaN
     1   2   3   4   5   6
     1   2   3   4   5   6
     1   2   3   4   5   6
     1   2   3   4   5   6
%}

us