How to plot points of same color based on values

1 次查看(过去 30 天)
a = ginput(33);
a1 = input('initial value of a1: ');
a17 = input('initial value of blank or a17: ');
noth = input('value of the fields that are not counted: ');
a2 = a1; a3 = a1;
a4 = a1; a5 = a1; a6 = a1;
a7 = a1; a8 = a1; a9 = a1; a10 = a1; a11 = a1; a12 = a1; a13 = a1;
a14 = a1; a15 = a1; a16 = a1; a18 = a1; a19 = a1; a20 = a1;
a21 = a1; a22 = a1; a23 = a1; a24 = a1;a25 = a1; a26 = a1; a27 = a1;
a28 = a1; a29 = a1; a30 = a1;
a31 = a1; a32 = a1; a33 = a1;
%%design for game of hi Q
c = [noth,noth,a1,a2,a3,noth,noth;noth,noth,a4,a5,a6,noth,noth;a7,a8,a9,a10,a11,a12,a13;a14,a15,a16,a17,a18,a19,a20;a21,a22,a23,a24,a25,a26,a27;noth,noth,a28,a29,a30,noth,noth;noth,noth,a31,a32,a33,noth,noth];
now i wish to go like this
for i = 1:49
if c(i) == 1
then blue points would be plotted
if c(i)== 0
then red points would be plotted
and if c(i) == 2
then nothing will be plotted, it will be blank
how can i do this? please no rude comment. your help is appreciated.
  2 个评论
Image Analyst
Image Analyst 2014-4-24
What do you want to plot? c? The a's? Why do you have all those separate a's instead of an array?
OCEAN LOVER
OCEAN LOVER 2014-4-25
actually i am willing to design the game of peg solitaire or hi Q. a1, a2....a33 are all points on the board that are full or have some thing on them. so i gave them value 1. and a17 is the point which is blank so i gave it value 0. now i need to show that the points which are full will be displayed as blue points, and the points which are blank will be displayed as red points. is there a better way to do it, instead of this approach?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Strategy & Logic 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by