Azzera filtri
Azzera filtri

initialize set of sequence variables in a loop

7 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Dishant Arora
Dishant Arora il 1 Apr 2014

Più risposte (1)

Chandrasekhar
Chandrasekhar il 1 Apr 2014
Ti = [1:5];
is this what you are looking for?
  3 Commenti
Chandrasekhar
Chandrasekhar il 1 Apr 2014
for i = 1:5
eval(['T_' num2str(i) '=' num2str(i)]);
end

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by