rename a variable
41 views (last 30 days)
in my workspace i have an array that is named 'data' and I have a name field with some filename = 'filename'
I would like to rename the array called data to the name that is stored in the filename name variable.
simply doing filename = data; renames data to filename not the actual name that filename holds.
Matt Tearle on 5 Mar 2012
Let me see if I interpret the question correctly: you have
filename = 'bob';
data = [1,2,3];
And you want to rename data to bob (the contents of filename)?
Firstly, be careful doing things like this. It makes it very hard to track names. But, if you must...
str = [filename,'= data;'];