From: Richard on
Hi, I'm trying to load 25 files in a loop and assign the contents of each file to a unique name.
files on disk are named as
filenames0
filenames1
filenames2........

using the following code:

files=dir('pathtomyfiles\filenames*')
names=cell(25,1);

for i=1:25
fname=['file',num2str(i)];
names{i,1}=fname;
end

I end up with a cell array of data(file contents) which I understand but I don't know how to do what I'm trying to do??
From: Ross W on
"Richard " <REMOVETHISrcaldwellie(a)yahoo.com> wrote in message <i40fuo$okv$1(a)fred.mathworks.com>...
> Hi, I'm trying to load 25 files in a loop and assign the contents of each file to a unique name.
> files on disk are named as
> filenames0
> filenames1
> filenames2........
>
> using the following code:
>
> files=dir('pathtomyfiles\filenames*')
> names=cell(25,1);
>
> for i=1:25
> fname=['file',num2str(i)];
> names{i,1}=fname;
> end
>
> I end up with a cell array of data(file contents) which I understand but I don't know how to do what I'm trying to do??

Hi

Did you read this?
http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_process_a_sequence_of_files.3F

It might be a good start.

Ross
From: Image Analyst on
Why can't you just process your file right then and there in the loop? Why do you have to make up a cell array?
From: Richard on
"Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <i40mvr$hfe$1(a)fred.mathworks.com>...
> Why can't you just process your file right then and there in the loop? Why do you have to make up a cell array?
good suggestion. Thanks. Thats sorted it..
 | 
Pages: 1
Prev: PSD and Correlation
Next: Determine Rise