How can I make the following expression changes dynamically?

How can I make the following expression changes dynamically?
VariableX = importdata ('FilenameX.out');
where, everything is constant but the "X" is a integer number that changes from 1 to 5
for example: hello4 = impotdata ('file4.out');

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 31 de Jul. de 2012
Editada: Azzi Abdelmalek el 31 de Jul. de 2012
for k=1:4
Filename='exemple', %exemple
file=strcat(Filename,num2str(k),'.out')
evalc(strcat('Variable',num2str(k),' = importdata(''',file,''')'));
end

3 comentarios

Thanks for response but this solves the right hand side of the expression.
Note that I need the "X" in "VariableX" to change too
Azzi Abdelmalek
Azzi Abdelmalek el 31 de Jul. de 2012
Editada: Azzi Abdelmalek el 12 de Sept. de 2012
ok , I will fix it
Yes .. it works... much appreciate your effort .. Thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dynamic System Models en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 31 de Jul. de 2012

Editada:

el 25 de Jun. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by