Path: news.mathworks.com!not-for-mail
From: "Leslie McBrayer" <lmcbrayer@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: alternative to laod file?
Date: Tue, 29 Sep 2009 08:38:47 -0400
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <h9sv4p$8dr$1@fred.mathworks.com>
References: <h9snuj$csk$1@fred.mathworks.com> <d9f2404e-9774-4ee2-bda3-472235cc1296@e8g2000yqo.googlegroups.com> <h9sp5u$7sn$1@fred.mathworks.com>
Reply-To: "Leslie McBrayer" <lmcbrayer@mathworks.com>
NNTP-Posting-Host: mcbrayerl.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1254227929 8635 172.31.45.140 (29 Sep 2009 12:38:49 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 29 Sep 2009 12:38:49 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Xref: news.mathworks.com comp.soft-sys.matlab:573642


> I do know the number of  rows and columns of uncorrupt data (say for ex 
> 999 x 1000).  So the following should work
>
> u=1:500;
>
>   FID=ID=['Rx' num2str(u) '.txt']
>   D=texscan(FID,999,1000);
> end
>
> ?

Not quite.  With textscan, you need to:
* Open the file with fopen to get fid.
* Describe the columns with format specifiers such as %d or %f.
* Specify only a single repetition factor (not rows and columns).

For your case, I would recommend the dlmread function.  For example:

for u=1:500;

     filename = sprintf('Rx%d.txt', u);
     D = dlmread(filename, '', [0 0 999 1000]);

end

For more info, type "doc dlmread" at the command prompt.