How can I make the following expression changes dynamically?

조회 수: 1 (최근 30일)
Ahmed Elkady
Ahmed Elkady 2012년 7월 31일
편집: Stephen23 2019년 6월 25일
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
Azzi Abdelmalek
Azzi Abdelmalek 2012년 7월 31일
편집: Azzi Abdelmalek 2012년 9월 12일
ok , I will fix it
Ahmed Elkady
Ahmed Elkady 2012년 7월 31일
Yes .. it works... much appreciate your effort .. Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (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