Concatenate two strings in Matlab coder
14 views (last 30 days)
Ryan Livingston on 10 Sep 2016
If you have strings in MATLAB, then just concatenate them in MATLAB:
str1 = 'foo';
str2 = 'bar';
str3 = [str1 str2];
MATLAB Coder will happily generate code for this.
If you're passing strings via coder.ceval then yes, you do have to null-terminate the strings since that is what strcat is expecting.
str1 = ['foo' 0];
str2 = ['bar' 0];
will do the trick.