matlab space error problem
1 次查看(过去 30 天)
显示 更早的评论
does anyone know why my output doen't have space between two words
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/304699/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/304703/image.png)
11 个评论
Brent Kostich
2020-5-28
Did you not write this function? If you are asking me if your own test case is right, then I take it you have no idea what that code is doing.
If that is true, then no one can help you.
回答(2 个)
Fangjun Jiang
2020-5-28
From "help strcat"
For character array inputs, strcat removes trailing ASCII white-space
characters: space, tab, vertical tab, newline, carriage return, and
form-feed. To preserve trailing spaces when concatenating character
arrays, use horizontal array concatenation, [s1, s2, ..., sN]
0 个评论
Steven Lord
2020-5-28
You can use concatenation as Fangjun Jiang and Brent Kostich suggested. I'd probably use join instead.
join(["I", "love", "Georgia", "Tech"])
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!