The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: save variables
Replies: 3   Last Post: Nov 29, 2012 3:28 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: save variables
Posted: Nov 29, 2012 9:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Candace " <> wrote in message
> Is it possible to save a variable with a specific name that is
> independently created? For example, I want the variable B to be saved as
> 'TargetS_Fixations'.
> B=[1 2 3 4];
> N1='TargetS';
> N2='_Fixations';
> N3=strcat(N1,N2);
> Using the command "save N3 B" leads to variable B being saved with the
> name "N3". However, I want it to be saved with the name
> "TargetS_Fixations".

If the name of the MAT-file to which you want to save the variable is stored
in a variable itself, use the function form of SAVE not the command form.

save(N3, 'B')

See the second Example from the documentation page for SAVE for a complete

Steve Lord
To contact Technical Support use the Contact Us link on

Date Subject Author
Read save variables
Read Re: save variables
Read Re: save variables
Steven Lord
Read Re: save variables

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.