From: Nicolas on
Hi all,

I have a loop set up where I load up a new file with each iteration. I can't quite figure out how to set up my script to account for the changing file name.

E.g.:

for i=1:10
filename = sprintf('file%d,' i);
load filename;
end

since the load function requires a file path, I cannot readily use variables with it. What can I do to allow load to take on variables as its input?

Any tips or guidance is appreciated!

Thanks,
Nick
From: David Young on
Use the functional form of load instead of the command-line form:

load(filename);

- see help load.
From: Nicolas on
"David Young" <d.s.young.notthisbit(a)sussex.ac.uk> wrote in message <hq6ibc$sup$1(a)fred.mathworks.com>...
> Use the functional form of load instead of the command-line form:
>
> load(filename);
>
> - see help load.


...... I thought I had tried every possibility! And yet, I missed something so simple. Thanks for the quick reply; it worked wonderfully!
 | 
Pages: 1
Prev: multi-row image stitching
Next: interp3 problems