How to convert numeric array to cell array of chars and concat with chars in one line?
Example:
I have a numeric array:
[1, 5, 12, 17]
I want to convert it to a cell array of chars and concat with the chars 'Sensor ' and get:
{'Sensor 1', 'Sensor 5', 'Sensor 12', 'Sensor 17'}
Is there a way to do this in one line?
I got for now:
nums = [1, 5, 12, 17];
cellfun(@(x) ['Sensor ' num2str(x)], num2cell(nums), 'UniformOutput', 0)
Is there a simpler or more compact way?