from string array to variable names
21 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Matt Kindig
2012-3-29
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!