initialize set of sequence variables in a loop

3 visualizaciones (últimos 30 días)
Sososasa
Sososasa el 1 de Abr. de 2014
Comentada: Sososasa el 2 de Abr. de 2014
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?

Respuesta aceptada

Dishant Arora
Dishant Arora el 1 de Abr. de 2014

Más respuestas (1)

Chandrasekhar
Chandrasekhar el 1 de Abr. de 2014
Ti = [1:5];
is this what you are looking for?
  3 comentarios
Chandrasekhar
Chandrasekhar el 1 de Abr. de 2014
for i = 1:5
eval(['T_' num2str(i) '=' num2str(i)]);
end
Sososasa
Sososasa el 2 de Abr. de 2014
Thank you :) that helped

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by