The following piece of code only plots 4 points and it should plot 5 (not 6 because two points overlap). I was wondering if you could tell me how to fix it.
A = [5;5;5;3;3;2];B = [10;4;10;10;4;4];for n = 1:length(A)if A(n) == 5 plot(A(n),B(n),'rx')elseif A(n) == 3 hold on plot(A(n),B(n),'bx')else hold on plot(A(n),B(n),'gx')endendaxis([0 10 0 20])
Please note that I want to use if staments.
The output should be:
But the bottom red point is missing when using the code above…
Best Answer