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 个评论
Stephen23
2020-1-18
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!