Hi Juanjo,
I understand you would like to perform “mean” operations on a classified 2D array.
For this you can use the “accumarray” function in MATLAB to perform arithmetic operations on classified arrays.
You can resolve your query using “accumarray” as follows:
X=[1 3;2 5; 5 7;10 15;64 67];
classes=[1 3 1 2 2]';
res=[accumarray(classes,X(:,1),[],@mean) accumarray(classes,X(:,2),[],@mean)]
You can refer to the “accumarray” documentation using the following link.
Hope this will help!