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 commentaire

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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by