I am new to matlab. I have a categorical input predictor(X) and the set of past results (Y, binary). I would like to convert it to numeric variable in the following method. For each category calculate the average of Y and replace the value with the average. for example:
X Y X'
1 1 1
2 0 0
3 1 0.5
1 1 1
2 0 0
3 0 0.5
Please help.