initialize set of sequence variables in a loop

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?

 Akzeptierte Antwort

Weitere Antworten (1)

Chandrasekhar
Chandrasekhar am 1 Apr. 2014
Ti = [1:5];
is this what you are looking for?

3 Kommentare

Sososasa
Sososasa am 1 Apr. 2014
No I want different variables for different values. and I want the variables to be created inside a loop, and there names in sequence order. T1=1 T2=2
for i = 1:5
eval(['T_' num2str(i) '=' num2str(i)]);
end
Sososasa
Sososasa am 2 Apr. 2014
Thank you :) that helped

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by