如何将字符串转换成矩阵名称。
10 views (last 30 days)
Show older comments
str_var = 'var1';
eval( [str_var, '= 10']);
这样得到的结果是var1=10。如何让var1等于一个指定的矩阵,而不是一个数。
0 Comments
Accepted Answer
tfgkywm
on 25 May 2023
A = [1 2 3];
str_var = 'var1';
eval( [str_var, '= A']);
结果
var1 =
1 2 3
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!