|
"Bruno Luong" <b.luong@fogale.fr> wrote in message
<g4o31t$bj$1@fred.mathworks.com>...
> "Francesco " <fsarnari@maths.leeds.ac.uk> wrote in message
> <g4nse3$gco$1@fred.mathworks.com>...
> > Hi everybody,
> > I am trying, in a for loop over the index j to
load .mat
> > files (data_%d.mat) from an external hard drive E:\.
> > My files are stored in the directory dir2 and I would
like
> > to load only variables var1 and var2 from the .mat file.
> > I am trying to use this string, but it doesn't work...
> >
> > for j=1:N
> > filename = num2str(j,'data_%d.mat');
> > load(j,'E:\dir1\dir2\filename', 'var1','var2')
> > end
> >
> > What am I doing wrong? Could you help me to write it
>
> 1. 'E:\dir1\dir2\filename'
>
> MATLAB will try to look the file named 'filename' and not
> 'data_??mat'. You need to build the string of path with
the
> variable filename
>
> Take a look of:
> > help strings
>
> 2. MATLAB cannot load subset of variables in MAT file
> For correct calling syntax, take a look
> > help load
>
> Bruno
Thanks, Bruno!
Now it works.
Francesco
|