Professional Documents
Culture Documents
Lecture 19
MATLAB Demo
%MATLAB Example use of ginput
clear, clf, hold off
axis ([0, 10, 0, 10])
hold on
plot ([1, 2, 2, 1, 1],[2, 2, 3, 3, 2])
text (1, 1.6, 'Click inside box to quit')
while 1
[x, y, buttun] = ginput (1)
if buttun == 1, plot (x, y, '+r'), end
if buttun == 2, plot (x, y, 'oy'), end
if buttun == 3, plot (x, y, '*g'), end
if x > 1 & x < 2 & y > 2 & y < 3, break;
end
end
hold off
Winter Quarter The Ohio State University Lect 19 P. 6
Gateway Engineering Education Coalition
Engineering H192 - Computer Programming