Calling variables instead of values
1 次查看(过去 30 天)
显示 更早的评论
I have this:
A=1; B=2; C=3;
x = [2 3 1]
I want to call x1 as:
x1 =
B C A
I can call individual values, but I don't know how to call them as variables.
0 个评论
采纳的回答
Andrei Bobrov
2011-10-31
xc = num2cell(x)
[B C A]= xc{:}
ADD
x = [2 3 1]
xc = {'A' 'B' 'C'}
x1 = xc(x)
2 个评论
Jan
2011-10-31
@Will: What does "[B C A]" exactly mean? Is it a cell string, a string or a symbolic expression?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Variables, Expressions, Functions, and Preferences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!