Creating Dynamic variables for future use
11 次查看(过去 30 天)
显示 更早的评论
Hi.
I need to create variables for future use in a loop. For example, for i=1,2,...n, I need to save D1, D2,...,DN, where each Di is a vector with different dimension.
Can anybody help me?
Marco.
0 个评论
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2012-9-12
编辑:Azzi Abdelmalek
2012-9-12
for k=1:4
v.(sprintf('D%d',k))=rand(k,2)
end
your array are v.D1, v.D2, ...
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!