函數星座
圖(' WindowButtonDownFcn ',@wbdcb)
ah = axes('DrawMode ',' fast ');
坐標軸([1 10 1 10])
標題(“畫壹個星座”)
color 1 = ' brcmkgy ';
num = 1;
函數wbdcb(src,evnt)
if strcmp(get(src,' SelectionType '),' normal ')
集合(src,'指針','圓圈')
cp = get(啊,' current point ');
xinit = cp(1,1);yinit = cp(1,2);
hl = line('XData ',xinit,' YData ',yinit,...
標記',' p ','顏色',color 1(num));
set(src,' WindowButtonMotionFcn ',@wbmcb)
set(src,' WindowButtonUpFcn ',@wbucb)
結束
功能wbmcb(src,evnt)
cp = get(啊,' current point ');
xdat = [xinit,cp(1,1)];
ydat = [yinit,cp(1,2)];
set(hl,' XData ',xdat,' YData ',ydat);drawnow
結束
函數wbucb(src,evnt)
if strcmp(get(src,' SelectionType '),' alt ')
num = num+1;
如果num & gt七
num = 1;
結束
集合(src,'指針','箭頭')
set(src,' WindowButtonMotionFcn ','')
set(src,' WindowButtonUpFcn ','')
其他
返回
結束
結束
結束
結束