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 Commento

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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Tag

Richiesto:

il 18 Gen 2020

Commentato:

il 18 Gen 2020

Community Treasure Hunt

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

Start Hunting!

Translated by