function pushbutton1_Callback(hObject, eventdata, handles)
h=gcf;
untitled12;%这里是你写的对应GUI代码的名称
close(h);
DDA画线算法
function pushbutton3_Callback(hObject, eventdata, handles)%运行按钮
str1=get(handles.x1,'String');%文本框
str2=get(handles.y1,'String');
str3=get(handles.x2,'String');
str4=get(handles.y2,'String');
str5=get(handles.color,'String');x(1)=str2double(str1);x(2)=str2double(str2);y(1)=str2double(str3);y(2)=str2double(str4);
col=str2double(str5);
L=max(abs(x(1)-y(1)),abs(x(2)-y(2)));
k=(x(2)-y(2))/(x(1)-y(1));for i=1:1:L+1X(i)=x(1);Y(i)=x(2);x(1)=x(1)+1;x(2)=x(2)+k;
end
Y=fix(Y+0.5);if(col==1)plot(handles.axes1,X,Y,'r');
hold on
end
if(col==2)plot(handles.axes1,X,Y,'g');
hold on
end
if(col==3)plot(handles.axes1,X,Y,'b');
hold on
end
title('DDA划线算法');comet(X,Y)