MATLAB: How to insert space between strings while doing strcat

string

for eg: a='hello'; b='world'; strcat(a,b);
strcat(a,b) gives 'helloworld' But I need it as 'hello world' How can I do that ?

Best Answer

Use the square bracket [] concatenation operator, and including a space variable is the easiest way:
a='hello';
b='world';
s = ' ';
Result = [a,s,b]
Result =
hello world