I need to find the min and max of each unique ID in a matrix. I have a unique ID X:1 matrix such as for example [10 17 201 333 1000]' (This matrix will always be the smaller of the two)
My second matrix is a Nx2 matrix where the first column is a series of uniq IDs and the second column the values
ex [10 10 17 17 17 201 1000; 0.1 69 1.7 33 55 67 0.99]
The output would be two matrixes both of the size X:1 where one would be the min and the other the max such as 0.1 being th minimum for ID 10 and maximum for ID 10 would be 69 and then on to the next unique ID until completed. If in the case where there is no Unique ID in the NX2 matching to X:1 Matrix the value outputed for it would be a 0. For that Unique ID.
I am assuming a imbedded for loop with indexing but Ive been getting nowhere.