Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Plot certain values in cell array in color
Replies: 0

 Jannet Posts: 4 Registered: 10/11/12
Plot certain values in cell array in color
Posted: Dec 6, 2012 3:17 PM

Hi Guys

This is driving me crazy. I am trying to plot values between 2 and 3 on the y axis for cell array in red.It is plotting everything green and I am stuck. So this is partially working. Any help appreciated.

numsteps = 200;

x1 = 2:1:numsteps;
x2 = 2:1:numsteps;
y1 = 2:1:numsteps;
y2 = 2:1:numsteps;
for ii = 2:1:(numsteps) %Looping
y1(ii) = d(x1(ii)); % Data point ii has come in.
y2(ii) = d(x2(ii) );
if M2{1,1}(ii)<=2 & M2{1,2}(ii)>=3 || M3{1,1}(ii)<=2 & M3{1,2}(ii)>=3
c = 'r*'; % Color for values between 2 and 3 y axis

else
c = 'g*'; % values greater than 3 and less than 2
end
plot(M2{1,1}(ii),M2{1,2}(ii),c,M3{1,1}(ii),M3{1,2}(ii),c))

hold on
end