if A is a 10×4 matrix with some repeated values along A(:,1) like:
A=[1 10 13 311 15 33 221 43 3 121 3 54 122 45 34 132 44 31 122 32 35 113 34 13 313 34 34 124 35 23 43];
I want to plot scatter(A(:,4),A(:,3)) with the same dot color for every value of A(:,1) that is repeated. For instance a manual plot of A would be:
scatter(A(1:4,4),A(1:4,3),'filled','r')hold onscatter(A(5:7,4),A(5:7,3),'filled','b')hold onscatter(A(8:9,4),A(8:9,3),'filled','k')hold onscatter(A(10,4),A(10,3),'filled','g')
Which plots
I used manually the colors red, blue, black and green for the first 4 repeated values. But to analize a big dataset, i would like to plot the scatter using a colorbar for the increasing A(:,1) repeated values.
Best Answer