Re: [問題] 用scatter畫圖並著色已回收

看板MATLAB作者 (LIERO)時間16年前 (2009/12/07 10:37), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串2/2 (看更多)
※ 引述《LIERO (LIERO)》之銘言: : 各位板友們早安~ : 目前碰到一個問題是 : 我用scatter畫出兩向量的散布圖後 : 想令某些點是紅色,某些點是藍色 : 某些點是橙色、綠色…等 : 不知道板上的朋友們有沒有什麼好方法 : 好指令可以跟我說一下呢 : 感恩感恩~ 後來我用如下的方法: for m = 1:(901*801) % cluster center of coherency matrices of class Z9 if ((x(m) >= 0) & (x(m) <= 0.5)) & ((y(m) >= 0) & (y(m) <= 2*pi/9)) scatter(x(m),y(m),1,'blue'); hold on; % cluster center of coherency matrices of class Z8 elseif ((x(m) >= 0) & (x(m) <= 0.5)) & ((y(m) <= 5*pi/18) & (y(m) >= 2*pi/9)) scatter(x(m),y(m),1,[0 0.5 1]); hold on; % cluster center of coherency matrices of class Z7 elseif ((x(m) >= 0) & (x(m) <= 0.5)) & ((y(m) >= 5*pi/18) & (y(m)<= pi/2)) scatter(x(m),y(m),1,[1 0 1]); hold on; % cluster center of coherency matrices of class Z6 elseif ((x(m) <= 0.9) & (x(m) >= 0.5)) & ((y(m) >= 0) & (y(m) <= 2*pi/9)) scatter(x(m),y(m),1,[0 1 1]); hold on; % cluster center of coherency matrices of class Z5 elseif ((x(m) <= 0.9) & (x(m) >= 0.5)) & ((y(m) <= 5*pi/18) & (y(m) >= 2*pi/9)) scatter(x(m),y(m),1,'g'); hold on; % cluster center of coherency matrices of class Z4 elseif ((x(m) <= 0.9) & (x(m) >= 0.5)) & ((y(m) >= 5*pi/18) & (y(m) <= pi/2)) scatter(x(m),y(m),1,'y'); hold on; % cluster center of coherency matrices of class Z2 elseif ((x(m) >= 0.9) & (x(m) <= 1)) & ((y(m) >= 0) & (y(m) <= pi/3)) scatter(x(m),y(m),1,[1 0.5 0]); hold on; % cluster center of coherency matrices of class Z1 else ((x(m) >= 0.9) & (x(m) <= 1)) & ((y(m) <= pi/2) & (y(m) >= pi/3)) scatter(x(m),y(m),1,'r'); hold on; end end -- 但是 command window會一直跑出 ans=1 ans=1 不知道是怎麼回事@@ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.19.177

12/07 13:45, , 1F
else 後面不需要判斷式,所以會出現 ans=1
12/07 13:45, 1F

12/07 17:27, , 2F
感恩~那樓上知道imshow如何指定一個點的顏色嗎
12/07 17:27, 2F
文章代碼(AID): #1B76fWkC (MATLAB)
文章代碼(AID): #1B76fWkC (MATLAB)