scatter(X,Y,S,C) displays colored circles at the locations specified by the vectors X and Y (which must be the same size).
S determines the area of each marker (specified in points^2). S can be a vector the same length as X and Y or a scalar. If S is a scalar, MATLAB draws all the markers the same size. If S is empty, the default size is used.
C determines the color of each marker. When C is a vector the same length as X and Y, the values in C are linearly mapped to the colors in the current colormap. When C is a length(X)-by-3 matrix, it specifies the colors of the markers as RGB values. C can also be a color string (see ColorSpec for a list of color string specifiers).
上面的是help里面的话,里面说了When C is a length(X)-by-3 matrix,t specifies the colors of the markers as RGB values,也就是后面决定颜色的RGB不能只是一列数组,要是length(X)-by-3 matrix。
scatter(msdata(i,1),msdata(i,2),'.',[0.1,0.3,0]); 可以改成
scatter(msdata(i,1),msdata(i,2),'.',ones(length(msdata(i,1)))*[0.1,0.3,0]);
自己揣摩下试试
温馨提示:答案为网友推荐,仅供参考