Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
multiplot from many files

Subject: multiplot from many files

From: sarrah

Date: 28 Jun, 2009 14:57:01

Message: 1 of 6

data1=load('filea.mat');
data2=load('fileb.mat');

cc=variable(data1,data2); %same variable but different value and from different file.
dd=variable2(data1,data2); % variable2 from 2 sources of files which is data1 and data2

There's more coding here...

I got this error..
??? Undefined function or method 'variable' for input arguments of type 'struct'.

I found out the function in matlab where we can assign the variable value we want into the workspace but this will overwrite my second value of same variable but from different file.

Any idea how to write down the proper way? Thanks in advance.

Subject: multiplot from many files

From: Faraz Afzal

Date: 28 Jun, 2009 15:27:01

Message: 2 of 6

I really did not understood your problem completely, but as far as I guess this error pops up when u have problem with working directories... so all you need to do is to put the files u r accessing in the same folder and add it to path or make it as current working directory...

RUn again.. and problem go away.. Try this..

Regards,
Faraz


"sarrah " <gto_girlz83@yahoo.com> wrote in message <h280bt$f1k$1@fred.mathworks.com>...
> data1=load('filea.mat');
> data2=load('fileb.mat');
>
> cc=variable(data1,data2); %same variable but different value and from different file.
> dd=variable2(data1,data2); % variable2 from 2 sources of files which is data1 and data2
>
> There's more coding here...
>
> I got this error..
> ??? Undefined function or method 'variable' for input arguments of type 'struct'.
>
> I found out the function in matlab where we can assign the variable value we want into the workspace but this will overwrite my second value of same variable but from different file.
>
> Any idea how to write down the proper way? Thanks in advance.

Subject: multiplot from many files

From: sarrah

Date: 28 Jun, 2009 15:38:01

Message: 3 of 6

Sorry I forgot to explain. I already put that .mat files into the same directory. But still got error.

Actually I want to plot a figure from multiple files and several values. In my case, data1 and data2 has variable cc and dd that I want to use it. So looks like the problem is with reading the correct file and how to assign value of variable cc from data1 and data2 into a struct?

For example, if I assigned cc=[10,100]; I want to get this 2 values from same variable but from 2 files :data1(value=10) and data2(value=100)

I hope this already clear. Thanks.

"Faraz Afzal" <farazafzal@gmail.com> wrote in message <h28245$5oi$1@fred.mathworks.com>...
> I really did not understood your problem completely, but as far as I guess this error pops up when u have problem with working directories... so all you need to do is to put the files u r accessing in the same folder and add it to path or make it as current working directory...
>
> RUn again.. and problem go away.. Try this..
>
> Regards,
> Faraz
>
>
> "sarrah " <gto_girlz83@yahoo.com> wrote in message <h280bt$f1k$1@fred.mathworks.com>...
> > data1=load('filea.mat');
> > data2=load('fileb.mat');
> >
> > cc=variable(data1,data2); %same variable but different value and from different file.
> > dd=variable2(data1,data2); % variable2 from 2 sources of files which is data1 and data2
> >
> > There's more coding here...
> >
> > I got this error..
> > ??? Undefined function or method 'variable' for input arguments of type 'struct'.
> >
> > I found out the function in matlab where we can assign the variable value we want into the workspace but this will overwrite my second value of same variable but from different file.
> >
> > Any idea how to write down the proper way? Thanks in advance.

Subject: multiplot from many files

From: TideMan

Date: 28 Jun, 2009 21:02:22

Message: 4 of 6

On Jun 29, 3:38 am, "sarrah " <gto_girl...@yahoo.com> wrote:
> Sorry I forgot to explain. I already put that .mat files into the same directory. But still got error.
>
> Actually I want to plot a figure from multiple files and several values. In my case, data1 and data2 has variable cc and dd that I want to use it. So looks like the problem is with reading the correct file and how to assign value of variable cc from data1 and data2 into a struct?
>
> For example, if I assigned cc=[10,100]; I want to get this 2 values from same variable but from 2 files :data1(value=10) and data2(value=100)
>
> I hope this already clear. Thanks.
>
> "Faraz Afzal" <farazaf...@gmail.com> wrote in message <h28245$5o...@fred.mathworks.com>...
> > I really did not understood your problem completely, but as far as I guess this error pops up when u have problem with working directories... so all you need to do is to put the files u r accessing in the same folder and add it to path or make it as current working directory...
>
> > RUn again.. and problem go away.. Try this..
>
> > Regards,
> > Faraz
>
> > "sarrah " <gto_girl...@yahoo.com> wrote in message <h280bt$f1...@fred.mathworks.com>...
> > > data1=load('filea.mat');
> > > data2=load('fileb.mat');
>
> > > cc=variable(data1,data2); %same variable but different value and from different file.
> > > dd=variable2(data1,data2); % variable2 from 2 sources of files which is data1 and data2
>
> > > There's more coding here...
>
> > > I got this error..
> > > ??? Undefined function or method 'variable' for input arguments of type 'struct'.
>
> > > I found out the function in matlab where we can assign the variable value we want into the workspace but this will overwrite my second value of same variable but from different file.
>
> > > Any idea how to write down the proper way? Thanks in advance.

When you use the functional form of load like that, the arrays get put
into a structure, so cc from filea.mat is in data1.cc and cc from
fileb.mat is in data2.cc.
Now, as I understand you, you want to concatenate these, so:
cc=[data1.cc;data2.cc]; % if they are column vectors
cc=[data1.cc data2.cc]; % if they are row vectors
Either way if they are scalars.

Subject: multiplot from many files

From: sarrah

Date: 29 Jun, 2009 09:29:02

Message: 5 of 6

TideMan <mulgor@gmail.com> wrote in message <eea9f72c-b752-4b0a-9ff5-f3303aa669a4@a38g2000yqc.googlegroups.com>...
> On Jun 29, 3:38?am, "sarrah " <gto_girl...@yahoo.com> wrote:
> > Sorry I forgot to explain. I already put that .mat files into the same directory. But still got error.
> >
> > Actually I want to plot a figure from multiple files and several values. In my case, data1 and data2 has variable cc and dd that I want to use it. So looks like the problem is with reading the correct file and how to assign value of variable cc from data1 and data2 into a struct?
> >
> > For example, if I assigned cc=[10,100]; I want to get this 2 values from same variable but from 2 files :data1(value=10) and data2(value=100)
> >
> > I hope this already clear. Thanks.
> >
> > "Faraz Afzal" <farazaf...@gmail.com> wrote in message <h28245$5o...@fred.mathworks.com>...
> > > I really did not understood your problem completely, but as far as I guess this error pops up when u have problem with working directories... so all you need to do is to put the files u r accessing in the same folder and add it to path or make it as current working directory...
> >
> > > RUn again.. and problem go away.. Try this..
> >
> > > Regards,
> > > Faraz
> >
> > > "sarrah " <gto_girl...@yahoo.com> wrote in message <h280bt$f1...@fred.mathworks.com>...
> > > > data1=load('filea.mat');
> > > > data2=load('fileb.mat');
> >
> > > > cc=variable(data1,data2); %same variable but different value and from different file.
> > > > dd=variable2(data1,data2); % variable2 from 2 sources of files which is data1 and data2
> >
> > > > There's more coding here...
> >
> > > > I got this error..
> > > > ??? Undefined function or method 'variable' for input arguments of type 'struct'.
> >
> > > > I found out the function in matlab where we can assign the variable value we want into the workspace but this will overwrite my second value of same variable but from different file.
> >
> > > > Any idea how to write down the proper way? Thanks in advance.
>
> When you use the functional form of load like that, the arrays get put
> into a structure, so cc from filea.mat is in data1.cc and cc from
> fileb.mat is in data2.cc.
> Now, as I understand you, you want to concatenate these, so:
> cc=[data1.cc;data2.cc]; % if they are column vectors
> cc=[data1.cc data2.cc]; % if they are row vectors
> Either way if they are scalars.
--------------------------------------------------

Thank u very much TideMan!! You solve my problem. Instead of data1.cc, I put cc.data1 previously.

Beside cc, I also have variable dd=[data1.dd; data2.dd];

And now the problem start again with the plotting. Looks like it plotted the last result and not for all values in cc. FYI, I did use the hold on function. How can I plot this two variables with several values?

Thanks in advance.

Subject: multiplot from many files

From: TideMan

Date: 29 Jun, 2009 20:26:49

Message: 6 of 6

On Jun 29, 9:29 pm, "sarrah " <gto_girl...@yahoo.com> wrote:
> TideMan <mul...@gmail.com> wrote in message <eea9f72c-b752-4b0a-9ff5-f3303aa66...@a38g2000yqc.googlegroups.com>...
> > On Jun 29, 3:38?am, "sarrah " <gto_girl...@yahoo.com> wrote:
> > > Sorry I forgot to explain. I already put that .mat files into the same directory. But still got error.
>
> > > Actually I want to plot a figure from multiple files and several values. In my case, data1 and data2 has variable cc and dd that I want to use it. So looks like the problem is with reading the correct file and how to assign value of variable cc from data1 and data2 into a struct?
>
> > > For example, if I assigned cc=[10,100]; I want to get this 2 values from same variable but from 2 files :data1(value=10) and data2(value=100)
>
> > > I hope this already clear. Thanks.
>
> > > "Faraz Afzal" <farazaf...@gmail.com> wrote in message <h28245$5o...@fred.mathworks.com>...
> > > > I really did not understood your problem completely, but as far as I guess this error pops up when u have problem with working directories... so all you need to do is to put the files u r accessing in the same folder and add it to path or make it as current working directory...
>
> > > > RUn again.. and problem go away.. Try this..
>
> > > > Regards,
> > > > Faraz
>
> > > > "sarrah " <gto_girl...@yahoo.com> wrote in message <h280bt$f1...@fred.mathworks.com>...
> > > > > data1=load('filea.mat');
> > > > > data2=load('fileb.mat');
>
> > > > > cc=variable(data1,data2); %same variable but different value and from different file.
> > > > > dd=variable2(data1,data2); % variable2 from 2 sources of files which is data1 and data2
>
> > > > > There's more coding here...
>
> > > > > I got this error..
> > > > > ??? Undefined function or method 'variable' for input arguments of type 'struct'.
>
> > > > > I found out the function in matlab where we can assign the variable value we want into the workspace but this will overwrite my second value of same variable but from different file.
>
> > > > > Any idea how to write down the proper way? Thanks in advance.
>
> > When you use the functional form of load like that, the arrays get put
> > into a structure, so cc from filea.mat is in data1.cc and cc from
> > fileb.mat is in data2.cc.
> > Now, as I understand you, you want to concatenate these, so:
> > cc=[data1.cc;data2.cc];  % if they are column vectors
> > cc=[data1.cc data2.cc];   % if they are row vectors
> > Either way if they are scalars.
>
> --------------------------------------------------
>
> Thank u very much TideMan!! You solve my problem. Instead of data1.cc, I put cc.data1 previously.
>
> Beside cc, I also have variable dd=[data1.dd; data2.dd];
>
> And now the problem start again with the plotting. Looks like it plotted the last result and not for all values in cc. FYI, I did use the hold on function. How can I plot this two variables with several values?
>
> Thanks in advance.

You need to tell us what your plot command looks like and exactly what
you're trying to do.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us