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:
how to access the same variables from 2 files that has similar name saved in different folder.

Subject: how to access the same variables from 2 files that has similar name saved in different folder.

From: Antonio Valentine

Date: 16 Aug, 2012 03:00:22

Message: 1 of 2

I have saved file
folder "A"
a1.mat
a2.mat
folder "B"
a1.mat
a2.mat

however all the variables in a1,a2 from two folders are the same.

If I want to call just only a variable for plot that has the same name, what would be the command?

For example,

a1.mat has variable result1
a2.mat has variable result1

but two results has achieved from different settings. I want to plot them versus each different setting.

Subject: how to access the same variables from 2 files that has similar

From: TideMan

Date: 16 Aug, 2012 04:39:16

Message: 2 of 2

On Thursday, August 16, 2012 3:00:22 PM UTC+12, Antonio Valentine wrote:
> I have saved file
>
> folder "A"
>
> a1.mat
>
> a2.mat
>
> folder "B"
>
> a1.mat
>
> a2.mat
>
>
>
> however all the variables in a1,a2 from two folders are the same.
>
>
>
> If I want to call just only a variable for plot that has the same name, what would be the command?
>
>
>
> For example,
>
>
>
> a1.mat has variable result1
>
> a2.mat has variable result1
>
>
>
> but two results has achieved from different settings. I want to plot them versus each different setting.

Use:
s1=load(a1.mat);
s2=load(a2.mat);
Now, you have s1.result1 and s2.result1

Tags for this Thread

No tags are associated with 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