strjoin(S,'') % concatenate strings using strjoin() (recommended, available with version: R2016b) ABC
cell2mat(S) % concatenate strings using cell2mat() ABC
['A','B','C'] % simple array ABC S = { 'A','B','C' } strjoin(S,',') A,B,C strjoin(S) % default: space between stringsA B C strcat( cell2mat(strcat(S(1:end-1)',{' , '})'), S{end} ) A,B,C steps explained
1) add comma to each string
2) concatenate strings (cell2mat is used to covert string from cell-array into plain char)
3) for only adding the comma between strings, we need add the last string without comma
strcat( cell2mat(strcat(S(1:end-1)',{','})'), S{end} ) A,B,C
|
Strings >