Define an array with variable

3 ビュー (過去 30 日間)
C Zeng
C Zeng 2013 年 4 月 29 日
Hello, I wonder how can I define an array with a variable, for example,
x_i=an array, where i changes. I do not think Matlab allows such operations. How can I accommodate it? Later on I will use x_i in loops.
Thanks.

採用された回答

Sean de Wolski
Sean de Wolski 2013 年 4 月 29 日
  5 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 4 月 29 日
Yes, I do. You may find this Webinar helpful:
C Zeng
C Zeng 2013 年 4 月 30 日
Oh, great! Thanks so much!

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

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 4 月 29 日
k=4
assignin('base',sprintf('x_%d',k),[1 2 3])
  1 件のコメント
C Zeng
C Zeng 2013 年 4 月 29 日
Thanks.

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

カテゴリ

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