initialize set of sequence variables in a loop

조회 수: 11 (최근 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개)

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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by