Why does the STRCAT command remove the trailing spaces while performing a concatenation in MATLAB 7.4 (R2007a)?
Ältere Kommentare anzeigen
When I was performing some string concatenations, I noticed that STRCAT removes some characters that are not empty spaces, including new line characters from my strings.
I added a new line after a hello in string a. I did this using the SPRINTF command.
a = sprintf('hello \n')
b = 'world'
c = strcat (a , b)
For the above piece of code I received the following result
c = helloworld
I added defind two strings as shown below and I have added 5 spaces after hello in string a.
a = 'hello '
b = ' world'
c = strcat (a , b)
I received the following result
c = helloworld
Why the newline is also recognized as a trailing whitespace character?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!