MATLAB: How to make string vector

integerstringvector

range = [18,29];
how to make ['18','29']?
int2str(range); is not the solution

Best Answer

Here are three possible interpretation of the question.
1. To create one single string, exactly as per the original question:
>> vec = [18,29];
>> sprintf('%d',vec)
ans =
'1829'
2. To create a cell array of strings:
>> arrayfun(@int2str,vec,'UniformOutput',false)
ans =
'18' '29'
3. To create a character array with spaces separating the values:
>> int2str(vec) % or num2str
ans = '18 29'