Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Wavread loop: Variable filename
Date: Thu, 18 Sep 2008 09:31:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <gat74l$fol$1@fred.mathworks.com>
References: <gat6nh$c36$1@fred.mathworks.com>
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 1221730261 16149 172.30.248.35 (18 Sep 2008 09:31:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 18 Sep 2008 09:31:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:490740


"Koos Spee" <bmx_360@hotmail.com> wrote in message <gat6nh$c36$1@fred.mathworks.com>...
> Hello,
> 
> I have a set of (wav)files e.g.
> 
> file01.wav, file02.wav, file03.wav etc.
> 
> Now, I want to get load these files into Matlab with a loop and storing them into load01, load02, load03 etc
> 
> However I am not able to give them the correct filename. I tried for example:
> 
> for i=1:3
>     StrI=int2str(i);
>     WavName='file';
>     WavStored='load';
>     temp=strcat(WavName, StrI);
>     strcat(WavStored, StrI)=wavread(temp);
> end
> 
> Also looked into dir('*wav'), but that leads to the same problem
>  

you are missing the 0 out of the file name. include it in the string like this:
temp=strcat(WavName,'0',StrI)