How can I make the following expression changes dynamically?

1 次查看(过去 30 天)
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');

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2012-7-31
编辑:Azzi Abdelmalek 2012-7-31
for k=1:4
Filename='exemple', %exemple
file=strcat(Filename,num2str(k),'.out')
evalc(strcat('Variable',num2str(k),' = importdata(''',file,''')'));
end
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by