The fourth scatter argument allows you to specify the color. From the documentation :
scatter (X, Y, S, C)
...
C defines the color of each marker. When C is a vector of the same length as X and Y, values ββin C are linearly mapped to colors in the current color palette. When C is a 1 by 3 matrix, it defines marker colors as RGB values. If you have 3 points on the scatter plot and want the colors to be indices in the color palette, C should be a 3 by 1 matrix. C can also be a color string (see ColorSpec for a list of color string specifiers).
Try something like:
X = rand(1, 10); Y = rand(1, 10); colour = randi(3, 1, 10) colour = 2 1 3 1 3 1 2 2 3 1 scatter(X, Y, [], colour, 'filled');

If your datasets are large and there are several different color categories, I usually find that using plot with hold is a faster way to build.
source share