MATLAB: How to join 3 strings into single string

concatenation

I have a cell array [1*3 cell] Example Tcgh A6 1214 and i want to join them by put '-' in between and get Tcgh-A6-1214
i tried strcat and strjoin but doesn't work with me! Thanks

Best Answer

No ugly and inefficient loop is required:
>> C = {'Tcgh','A6','1214'};
>> out = sprintf('-%s',C{:});
>> out(2:end)
ans =
Tcgh-A6-1214