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 件のコメント
A Jenkins
A Jenkins 2014 年 3 月 5 日
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