matlab space error problem

조회 수: 2 (최근 30일)
Maria
Maria 2020년 5월 28일
댓글: Maria 2020년 5월 29일
does anyone know why my output doen't have space between two words
  댓글 수: 11
Brent Kostich
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.
Maria
Maria 2020년 5월 29일
gotcha it. I used horzcat instead of stracat and it works ! thanks !

댓글을 달려면 로그인하십시오.

답변 (2개)

Fangjun Jiang
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]

Steven Lord
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"])

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by