Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Variables within a for loop

조회 수: 1 (최근 30일)
Dominika
Dominika 2014년 3월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi I'm a beginner with Matlab. I want to create variables using a for loop:
Acc1=File_velocity_level_var1
Acc2=File_velocity_level_var2
.
.
Acc7=File_velocity_level_var7
I'm trying with this:
for n=1:7
Acc=strcat('File_velocity_level_var',n);
end
it just creates Acc=File_velocity_level_var
Please, help :)
  댓글 수: 2
David Young
David Young 2014년 3월 5일
If you made that comment an answer, I could (and would) vote for it!

답변 (2개)

Matt J
Matt J 2014년 3월 5일
편집: Matt J 2014년 3월 5일
You should be doing something like this,
for n=1:7
Acc{n}=['File_velocity_level_var',num2str(n)];
end
Now you have all the file names contained in the entries Acc{i} of a single variable Acc.

Dominika
Dominika 2014년 3월 8일
Thanks for all the answers

태그

Community Treasure Hunt

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

Start Hunting!

Translated by