aniso 发表于 2007-11-28 01:06

一个用鼠标选点、绘图的函数

% example
% t=1:4;a=t;
% plplot(t,a);

function pkplot=pkplot(t,a)
axis();
hold on
% Initially, the list of points is empty.
xy = [];
n = 0;
% Loop, picking up the points.
disp('Left mous e button picks points.')
disp('Right mouse button picks last point.')
but = 1;
while but == 1
    = ginput(1);
    plot(xi,yi,'ro')
    n = n+1;
    xy(:,n) = ;
end
% Interpolate with a spline curve and finer spacing.
t = 1:n;
ts = 1: 0.1: n;
xys = spline(t,xy,ts);
xys
% Plot the interpolated curve.
plot(xys(1,:),xys(2,:),'b-');
hold off

[ 本帖最后由 eight 于 2007-11-28 10:09 编辑 ]

eight 发表于 2007-11-28 10:09

原帖由 aniso 于 2007-11-28 01:06 发表 http://www.chinavib.com/forum/images/common/back.gif
% example
% t=1:4;a=t;
% plplot(t,a);

function pkplot=pkplot(t,a)
axis();
hold on
% Initially, the list of points is empty.
xy = [];
n = 0;
% Loop, picking u ...
这个貌似 help ginput 就有
页: [1]
查看完整版本: 一个用鼠标选点、绘图的函数