initialize set of sequence variables in a loop

3 ビュー (過去 30 日間)
Sososasa
Sososasa 2014 年 4 月 1 日
コメント済み: Sososasa 2014 年 4 月 2 日
hi,
I want to initialize a set of sequence variables in a loop:
for i=1:5
Ti=i;
end
so I can have: T1=1; T2=2; T3=3; ...
is there is a way in matlab to do such a thing?

採用された回答

Dishant Arora
Dishant Arora 2014 年 4 月 1 日
  1 件のコメント
Sososasa
Sososasa 2014 年 4 月 2 日
Thank you so much that informative

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

その他の回答 (1 件)

Chandrasekhar
Chandrasekhar 2014 年 4 月 1 日
Ti = [1:5];
is this what you are looking for?
  3 件のコメント
Chandrasekhar
Chandrasekhar 2014 年 4 月 1 日
for i = 1:5
eval(['T_' num2str(i) '=' num2str(i)]);
end
Sososasa
Sososasa 2014 年 4 月 2 日
Thank you :) that helped

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

カテゴリ

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