Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news.belwue.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail
From: Lothar Schmidt <vapooroop@gmx.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: parameterize filename
Date: Sun, 06 Jul 2008 19:06:08 +0200
Organization: 1&1 Internet AG
Lines: 25
Message-ID: <g4qu23$203$1@online.de>
References: <g4qq9q$o92$1@fred.mathworks.com>
NNTP-Posting-Host: p5b133bbd.dip0.t-ipconnect.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: online.de 1215363971 2051 91.19.59.189 (6 Jul 2008 17:06:11 GMT)
X-Complaints-To: abuse@einsundeins.com
NNTP-Posting-Date: Sun, 6 Jul 2008 17:06:11 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
In-Reply-To: <g4qq9q$o92$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:477755



GG schrieb:
> Hi, Is there a way to parameterize a filename in matlab?
> 
> For example, if I have 100 text files (file1.txt, 
> file2.txt ... file100.txt), and I want to process each 
> similarly, I'd like to write a loop such as,
> 
> for i=1:100
>   load file(i).txt;
>   data = file(i)' - mean( file(i) );
> end
> 
> The reason I need to do it this way is the file size is so 
> large I run into out-of-memory issues if I load it in as 
> one big file, so I've broken it up into many smaller files.
> 
> Thanks in advance, -GG

for i=1:100
	filename=['file' num2str(i) '.txt'];
	data=readfunction(filename);

	result=dowatheveryouwantto(data);
	perhapsoutputfunction(result);
end