1function plotDataPoints(X, idx, K) 2%PLOTDATAPOINTS plots data points in X, coloring them so that those with the same 3%index assignments in idx have the same color 4% PLOTDATAPOINTS(X, idx, K) plots data points in X, coloring them so that those 5% with the same index assignments in idx have the same color 6 7% Create palette 8palette = hsv(K + 1); 9colors = palette(idx, :); 10 11% Plot the data 12scatter(X(:,1), X(:,2), 15, colors); 13 14end 15 16