Path: news.mathworks.com!not-for-mail
From: "Dan " <ihatesp@mmers.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re:
Date: Mon, 3 Sep 2007 07:28:47 +0000 (UTC)
Organization: MBtech Powertrain GmbH
Lines: 39
Message-ID: <fbgd3f$rnn$1@fred.mathworks.com>
References: <fbf96u$i98$1@fred.mathworks.com>
Reply-To: "Dan " <ihatesp@mmers.com>
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 1188804527 28407 172.30.248.35 (3 Sep 2007 07:28:47 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 3 Sep 2007 07:28:47 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 525864
Xref: news.mathworks.com comp.soft-sys.matlab:426732


Hello

try it this way (num2str and [] ... or have a look at strcat)

filename_beginning='load filename_';
filename_ending='.mat';
for i=1:N
    load([filename_beginning,num2str(i),filename_ending]);
end

Dan

> Hi Everybody,
> I have the following problem:
> I would like to load a number N of files, say something 
> like
> 
> for i=1:N
>    load filename_i.mat
>    ...
>    ...
> end
> 
> where i is an integer (and positive) number.
> Could you tell me how shall I introduce the index of 
> my loop into the filename?
> Could you pls give me a simple example of that?
> Many thanks,
> Francesco
> 
> 
> 
> 
> 
> 
> 
> 
>