MATLAB: Convert values to string

cell arraystrings

I have a vector with values to define groups (groupValue, in this case 1000×1 array with values from 1 to 5) I also have a cell array with strings for each of these values (labels, 5×1 cell array) I want to have a 1000×1 cell array with strings for the labels instead of values. How can I do this more efficiently i.e. without a for loop?
for kk = 1:nElements
groupLabels{kk} = labels{groupValue(kk)};
end

Best Answer

Simply,
groupLabels = labels(groupValue);