Need a space in strcat comand
3 次查看(过去 30 天)
显示 更早的评论
V = [1 2 3 4 5];
strcat ('R = ', strjoin(string( V),', '))
I got the following answer while running the above code
"R =1, 2, 3, 4, 5"
But i need (a white space after '=' sign)
"R = 1, 2, 3, 4, 5"
1 个评论
Stephen23
2023-12-26
The solution is already given in the STRCAT documentation:
V = 1:5;
strcat({'R = '},strjoin(string( V),', '))
采纳的回答
Dyuman Joshi
2023-12-26
V = [1 2 3 4 5];
out1 = strjoin(["R =" strjoin(string(V),', ')])
You can also add strings like this -
out2 = "R = " + strjoin(string(V),', ')
0 个评论
更多回答(1 个)
另请参阅
类别
在 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!