How to save strings in a loop into an array?

조회 수: 14 (최근 30일)
Gunay Gazaloglu
Gunay Gazaloglu 2021년 4월 3일
댓글: Gunay Gazaloglu 2021년 4월 3일
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...

채택된 답변

Abdolkarim Mohammadi
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by