From: antonio ferreira on
Hi all.

I have a single code for solving two problems.In this context the variables are the same but their values are different.I want to plot some values of the variables for problem 1 and for problem 2.I have saved the variables with different names, however when I do load one variable substitutes the other.Does anyone now how can i solve this?

regards
From: Joseph on
"antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i2m7c9$791$1(a)fred.mathworks.com>...
> Hi all.
>
> I have a single code for solving two problems.In this context the variables are the same but their values are different.I want to plot some values of the variables for problem 1 and for problem 2.I have saved the variables with different names, however when I do load one variable substitutes the other.Does anyone now how can i solve this?
>
> regards

Not sure I get the question; but it seems like there is a some confusion as to how the 'save' and 'load' functions work. When you save a .mat file, you are probably also saving the variable name.

If that is the case try something like
a = yourfunction();
b = yourfunction();

save workspacename;

This will save two variables (a and b) that are easy to load later.

I'd suggest you read the save and load documentation as well
From: Jan Simon on
Dear Antonio,

>I have saved the variables with different names, however when I do load one variable substitutes the other.

The question is not clear to me.
You could post the relevant Matlab code, because this is understood by a lot of people reding this newsgroup and the Matlab interpreter defines a unique meaning...

If you use LOAD without an output argument, existing variables are overwritten. Therefore it is much cleaner and safer to use an output:
X = load(FileName)
and access the variables as fields of X.

Kind regards, Jan