Enter same string in an array.
7 次查看(过去 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 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!