From: Jean-Philip Dumont on
Hi,

I'm importing a time series into MATLAB. I have over 20 columns.

I'm using xlsread and here is the code :

[Data Titles] = xlsread('Name of file', 'Sheet', 'Range')

After that, I would like to separate all the different variables and give them a different name. I know I can access the 'Data' matrice to get whatever colum I need but there is no relation between the variables so I will have to remember the colum of each variable.

Basically, instead of doing :
Variable1 = Data(:,1);
Variable2 = Data(:,2);
and so on for over 20 times. But all the names are different so i can't make a loop and modify the name in the loop. Is there a way do to this automatically...or in a loop?

Is there a way to use the Titles I imported to identify each of my variable separatly?

Thank you very much!

JP
From: Steven Lord on

"Jean-Philip Dumont" <jean-philip.dumont(a)hec.ca> wrote in message
news:i1ppsi$elt$1(a)fred.mathworks.com...
> Hi,
>
> I'm importing a time series into MATLAB. I have over 20 columns.
>
> I'm using xlsread and here is the code :
>
> [Data Titles] = xlsread('Name of file', 'Sheet', 'Range')
>
> After that, I would like to separate all the different variables and give
> them a different name. I know I can access the 'Data' matrice to get
> whatever colum I need but there is no relation between the variables so I
> will have to remember the colum of each variable.
>
> Basically, instead of doing :
> Variable1 = Data(:,1);
> Variable2 = Data(:,2);
> and so on for over 20 times. But all the names are different so i can't
> make a loop and modify the name in the loop. Is there a way do to this
> automatically...or in a loop?

Yes, but you should not do so. See Q4.6 in the newsgroup FAQ for an
explanation.

--
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


From: Jean-Philip Dumont on
"Steven Lord" <slord(a)mathworks.com> wrote in message <i1prau$hv3$1(a)fred.mathworks.com>...
>
> "Jean-Philip Dumont" <jean-philip.dumont(a)hec.ca> wrote in message
> news:i1ppsi$elt$1(a)fred.mathworks.com...
> > Hi,
> >
> > I'm importing a time series into MATLAB. I have over 20 columns.
> >
> > I'm using xlsread and here is the code :
> >
> > [Data Titles] = xlsread('Name of file', 'Sheet', 'Range')
> >
> > After that, I would like to separate all the different variables and give
> > them a different name. I know I can access the 'Data' matrice to get
> > whatever colum I need but there is no relation between the variables so I
> > will have to remember the colum of each variable.
> >
> > Basically, instead of doing :
> > Variable1 = Data(:,1);
> > Variable2 = Data(:,2);
> > and so on for over 20 times. But all the names are different so i can't
> > make a loop and modify the name in the loop. Is there a way do to this
> > automatically...or in a loop?
>
> Yes, but you should not do so. See Q4.6 in the newsgroup FAQ for an
> explanation.
>
> --
> 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
>


I see! Thank you!