How to save strings in a loop into an array?
13 views (last 30 days)
Show older comments
Gunay Gazaloglu
on 3 Apr 2021
Commented: Gunay Gazaloglu
on 3 Apr 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/571709/image.png)
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...
0 Comments
Accepted Answer
Abdolkarim Mohammadi
on 3 Apr 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";
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!