可能重复:
How to concatenate a number to a variable name in MATLAB?
MATLAB: How can I use a variables value in another variables name?Matlab-如何基于其他变量的值命名新变量?
我想名称中使用的函数给出其他变量的值的变量。 因此,如果我的值为x1,x2,我可以将新变量的名称设为:
x_(x1's value)_(x2的值)作为名称。
我已经签出了eval,num2str,strcat函数,但是至今我还是无法做到这一点,所以我有一个变量名称,上面我可以指定一个值。
任何帮助将不胜感激。
这听起来像你应该使用数组来代替。 – JoshD 2010-10-07 18:40:41
这种事情已经被覆盖了几次:[Matlab的:在另一个变量名称中使用变量的值?](http://stackoverflow.com/questions/3346178/matlab-using-a-variables-value-in -another-variables-name),[如何在MATLAB中将数字连接到变量名?](http://stackoverflow.com/questions/2809635/how-to-concatenate-a-number-to-a-variable -name-in-matlab),[使用MATLAB循环函数来命名计算变量](http://stackoverflow.com/questions/3143959/using-matlab-loop-funtion-to-name-calculate-variables)。 – gnovice 2010-10-07 18:44:59
阅读@MatlabDoug的错误编码实践列表,特别是第一点http://blogs.mathworks.com/videos/2010/03/08/top-10-matlab-code-practices-that-make-me -cry/ – Amro 2010-10-07 18:53:05