Iam trying to have points in CG_X turned into a red color when its less than -15 or greater than 15 when I plot it on the graph using a for loop, but the end result gives me the standard blue color which is want i want when CG_X is greater than or equal to -15 and less than or equal to 15.
CG_X=[13.8 18 18.8 -5.7 2.2 -11.1 -6.3 12.4 -10.5 15.6]; CG_Y=[4.2 -13.2 -8 -11.3 11.2 1.5 -5.0 8 -7.1 19.7];hold on;for k=length(CG_X) if k>15||k<-15 plot(CG_X,CG_Y,'r*'); elseif k plot(CG_X,CG_Y,'b*'); endendhold off;
Best Answer