How to save strings in a loop into an array?
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Abdolkarim Mohammadi
2021-4-3
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";
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!