Convert A String Into a MATLAB Variable Name
Show older comments
I was trying to figure out if a had a string such as a= 'TEMP' and create a second variable which has the name TEMP which I would assign a corresponding value to. The problem is that I want to have 'TEMP' vary in a loop or as part of a function without have to manually assign it.
Answers (2)
Sean de Wolski
on 7 Jul 2011
1 vote
Don't do it!
What if the variable name is 'size' or 'sum' or something useful and you overwrite a needed builtin function?
1 Comment
Jan
on 7 Jul 2011
+1. And if it is possible: +1+1+1+1+1
Chirag Gupta
on 7 Jul 2011
0 votes
This is useful in certain cases as shown in the examples
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!