Creating Dynamic variables for future use

3 ビュー (過去 30 日間)
Marco Duarte
Marco Duarte 2012 年 9 月 12 日
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.

採用された回答

Sean de Wolski
Sean de Wolski 2012 年 9 月 12 日

その他の回答 (1 件)

Azzi Abdelmalek
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, ...
  1 件のコメント
Marco Duarte
Marco Duarte 2012 年 9 月 12 日
Thanks Azzi.
Very helpful.
Marco.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by