MATLAB: How to change the data from numeric to category in dataset using matlab

Hi Matlab Expert,
I am doing the classification analysis using matlab, in the final result i want to convert the numeric to category, actually this is very simple but I am still no finding how to code this.
For example, let I have dataset named as data.mat contains only 1 column with range 1-4:
%

1
1
1
1
2
2
2
3
3
3
4
4
4
I want to add additional column with category: if 1=good, 2=meddium , 3=bad 4=very bad, so the result should be like this:
%
1 good
1 good
1 good
1 good
1 good
2 medium
2 medium
2 medium
3 bad
3 bad
3 bad
4 very bad
4 very bad
4 very bad
Please help me how to code this in matlab? thanks!

Best Answer

Try this:
% Initialize/setup:
m = [1,1,1,1,2,2,2,3,3,3,4,4,4]
categories = {'good', 'medium', 'bad', 'very bad'}
% Get a list of what categories that the elements of m are.
mCategories = categories(m)
Also, please read the FAQ on cell arrays http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F and Accept the Answer if it answers your question.