This enhancement has been incorporated in Release 2008b (R2008b). For previous product releases, read below for any possible workarounds:
In MATLAB 7.4 (R2007a), the STRCAT command uses the ISSPACE function on trailing characters. If the result is true then STRCAT command ignores that space while performing concatenation. The characters which return a true value are ASCII white spaces including: space, newline, carriage return, tab, vertical tab and formfeed characters.
As a workaround, you can use the SPRINTF function to concatenate two strings. This function requires that you use formatting to specify what type of input you are using, but it will not remove any characters. For example, to concatenate a string with a new line character, you would use the following code:
a = sprintf('%s \n','Hello ');
b = 'world';
c = sprintf('%s %s',a,b)
This will result in:
Best Answer