user13549580
user13549580

Reputation:

Renaming a variable in GNU Octave

Let's say I have a variable g in my GNU Octave workspace. How can I rename it to f?

I tried using the rename function but I believe it is for another purpose.

Upvotes: 0

Views: 891

Answers (2)

Wilson Fuentes
Wilson Fuentes

Reputation: 1

You can change the name of one variable with assignin:

assignin ('base', 'new_name_variable', old_name_variable)

Upvotes: 0

Andrew Janke
Andrew Janke

Reputation: 23898

Yeah, rename is for files on the filesystem. To "rename" a variable, just assign it to a new variable and clear the old one.

f = g;
clear g

Upvotes: 3

Related Questions