from string array to variable names
20 views (last 30 days)
Show older comments
Hallo, I have a string array, say array A which has elements like A1 A2 A3 And I want to change them to variable names so that I can create another array based on these names. For example: for i=1:n A(i,1)= [X(i,1),Y(i,1)] end where X and Y are other arrays.
0 Comments
Answers (2)
Matt Kindig
on 29 Mar 2012
You can use genvarname to generate variable names.
doc genvarname
However, you probably don't want to actually do this. MATLAB recommends against making variables like A1, A2, etc. See below for suggested workarounds.
See Also
Categories
Find more on Cell Arrays 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!