Enter same string in an array.
조회 수: 28 (최근 30일)
이전 댓글 표시
hello, I would like to enter same string in an array. like:
Array1=[a,a,a,a,a,a]
Thanks.
댓글 수: 0
채택된 답변
Harshit Gupta
2022년 7월 16일
Hi, if your question is just about how to create an array of string, you can do it like this:
Array1 = ["a", "a", "a", "a", "a"]
Now if you want to repeat a single string multiple times to create an array, do it like this:
str = "a";
Array1 = repmat(str, 1, 5)
Refer to the documentation to know more: repmat
Hope this helps!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!