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 个)

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