create matrix in for loop with dynamic variable

3 次查看(过去 30 天)
I am wanting to replace the following:
%sensor 1 through 19 are numerical arrays of data.
i=19; %Sensor #
sensor=[sensor1 sensor2 sensor3 sensor4 sensor5 sensor6 sensor7 sensor8 sensor9 sensor10 sensor11 sensor12 sensor13 sensor14 sensor15 sensor16 sensor17 sensor18 sensor19];
with:
f=1;
for f=1:i
evaluate([sensor(:,f)= 'sensor' num2str(f)]);
f=f+1;
end
Any suggestions?

回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by