From: antonio ferreira on
I have two folders (conf1 and conf2). In these two folders I have the same variables. I pretend to use the load command however I am not being able to do that. This is the part of the code that I have created:

n_g=2;
path = pwd;
for i =1 : n_g
load([path num2str(i) '.mat']);
end

Could anyone please give me a suggestion in order to fix this?
From: us on
"antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i2n7lt$1p9$1(a)fred.mathworks.com>...
> I have two folders (conf1 and conf2). In these two folders I have the same variables. I pretend to use the load command however I am not being able to do that. This is the part of the code that I have created:
>
> n_g=2;
> path = pwd;
> for i =1 : n_g
> load([path num2str(i) '.mat']);
> end
>
> Could anyone please give me a suggestion in order to fix this?

other than:
what do you expect if you try to LOAD a folder with an extension(?)...
none...

us
From: antonio ferreira on
I was trying to follow this message:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274338. I have a followed the same procedure...i think


"us " <us(a)neurol.unizh.ch> wrote in message <i2n8a5$e6a$1(a)fred.mathworks.com>...
> "antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i2n7lt$1p9$1(a)fred.mathworks.com>...
> > I have two folders (conf1 and conf2). In these two folders I have the same variables. I pretend to use the load command however I am not being able to do that. This is the part of the code that I have created:
> >
> > n_g=2;
> > path = pwd;
> > for i =1 : n_g
> > load([path num2str(i) '.mat']);
> > end
> >
> > Could anyone please give me a suggestion in order to fix this?
>
> other than:
> what do you expect if you try to LOAD a folder with an extension(?)...
> none...
>
> us
From: us on
"antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i2n9rb$qv5$1(a)fred.mathworks.com>...
> I was trying to follow this message:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/274338. I have a followed the same procedure...i think
>
>
> "us " <us(a)neurol.unizh.ch> wrote in message <i2n8a5$e6a$1(a)fred.mathworks.com>...
> > "antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i2n7lt$1p9$1(a)fred.mathworks.com>...
> > > I have two folders (conf1 and conf2). In these two folders I have the same variables. I pretend to use the load command however I am not being able to do that. This is the part of the code that I have created:
> > >
> > > n_g=2;
> > > path = pwd;
> > > for i =1 : n_g
> > > load([path num2str(i) '.mat']);
> > > end
> > >
> > > Could anyone please give me a suggestion in order to fix this?
> >
> > other than:
> > what do you expect if you try to LOAD a folder with an extension(?)...
> > none...
> >
> > us

1) do NOT top post...
2) show CSSM the output of this
- note: do NOT create a var named PATH as this is a ML stock function...

r=[cd,num2str(1),'.mat'] % <- use the function CD...

us
From: Steven_Lord on


"antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message
news:i2n7lt$1p9$1(a)fred.mathworks.com...
> I have two folders (conf1 and conf2). In these two folders I have the same
> variables. I pretend to use the load command however I am not being able
> to do that. This is the part of the code that I have created:
>
> n_g=2;
> path = pwd;

Just FYI, by executing this command, you're eliminating any chance of using
the PATH function later in your code.

> for i =1 : n_g
> load([path num2str(i) '.mat']);

Call LOAD with an output argument to obtain a struct array whose field names
are the names of the variables from the file, and use dynamic field names
(or regular field names, if you know the variables you want to access when
you write the code) to extract the appropriate field.

BTW, you should use FULLFILE to construct the string containing the full
path to the file. Your code assumes that PWD ends with a FILESEP; I don't
know if that's guaranteed to be the case.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com