How to save strings in a loop into an array?

14 vues (au cours des 30 derniers jours)
Gunay Gazaloglu
Gunay Gazaloglu le 3 Avr 2021
In this case there are 200 wind directions such NNW,NE,WNW....However,I couldnt save them into a single string array.How can I list them as XXX,XXX...

Réponse acceptée

Abdolkarim Mohammadi
Abdolkarim Mohammadi le 3 Avr 2021
You should first initialize the direction vector:
direction = strings (1, 200);
Then assign a value to a certain element of direction in each loop iteration:
direction (i) = "NE";

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by