Is it possible generate and handle generated variable names?
4 次查看(过去 30 天)
显示 更早的评论
For example is it possible to make a for cycle which generates the following variables? v1 = 1; v2 = 2; v3 = 3;
0 个评论
回答(2 个)
Star Strider
2015-5-19
It is, but it is considered to be very bad programming practice.
It is better to create them as an array instead:
v(1) = 1;
v(2) = 2;
v(3) = 3;
This has the same effect, but is much more efficient and much easier to work with.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!