I have a matrix with 2 columns: example: A=[ 123 1; 444 2; 634 1; 311 1; 111 2; . . . 222 1; 312 1;]
First.I want to find the mean of the values in column 1 based on the values of column 2. Means for value 1(mean1) and for value 2(mean2).
Second. Ι want to subtract the means from the respective rows.The mean1 from the rows in column 1 that correspond to value 1 in column 2 and the mean2 from the rows in column 1 that correspond to 2 value in column 2. And take a column of the residuals without spoiling the sequence of the values.
thanks!
Best Answer