how to create wind direction categoricals
Afficher commentaires plus anciens
Hello. I m trying to create categoricals from wind directions (0 - 359 degrees) for 4 values: 1 = airport; 2 = bus_sta; 3= road; 4 = other
The compass degree ranges, resectively, are below, in a for loop, which did not work. I want to store the vlues in a vector of length specifed:
for i = 1:length(T1.classification)
if (45<=RMET2.Deg)&(RMET2.Deg<=65)
impact = impact(i);
elseif (260<=RMET2.Deg)&(RMET2.Deg<=280)
impact = impact(i);
elseif (80<=RMET2.Deg)&(RMET2.Deg<=100)
impact = impact(i);
else impact = impact;
end
end
5 commentaires
the cyclist
le 13 Mar 2023
Can you upload the input data? (You can use the paper clip icon in the INSERT section of the toolbar.) That would make it easier to help debug the code.
Walter Roberson
le 13 Mar 2023
impact = impact(i);
You are overwriting the complete array with a single element of the array, leaving it a scalar. The next iteration would fail.
Douglas Leaffer
le 13 Mar 2023
Douglas Leaffer
le 13 Mar 2023
Douglas Leaffer
le 13 Mar 2023
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Categorical Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!