looping with for through variables with multiple columns

Hi all!
I have 33 variables with multiple columns.. Does anyone knows how would be the statement in for loop?
sza = ["20_0","50_0","80_0"];
tau = ["0_0","0_5","1_0","1_5","2_0","3_0","4_0","5_0","10_0","15_0","20_0"];
for i=1:length(sza)
for j=1:length(tau)
statement
end
end
statement for just one double array: X20_0sza0_0tau(:,8) = (X20_0sza0_0tau(:,5) + X20_0sza0_0tau(:,6)).*4*pi;

1 个评论

X20_0sza0_0tau(:,8) = ...
It looks like you are putting meta-data into variable names. Meta-data is data, and should NOT be in variable names.
Accessing (meta-)data in variable names is one way that beginners force themselves into writing slow, complex, obfuscated, buggy code that is hard to debug. Read this to know why:
Most likely you should be using one array (e.g. numeric, structure, table, etc.) and accessing the data in that array.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by