|
原帖由 hanwangabc 于 2008-6-12 15:47 发表
实际结果我在matlab中试验是:
141 126 127 149
106 113 137 129
我用save xy.txt xy -ascii;保存后,打开xy.txt是这样的,
1.4100000e+002 1.2600000e+002 1.2700000e+002 1.490 ...
是不是这个:
-
- hold on
- clc
- clear
- xy = [];
- n = 0;
- %左键选点
- %右键选最后一个点
- bt = 1;
- while bt == 1
- [xi,yi,bt] = ginput(1);
- plot(xi,yi,'r.')
- n = n+1;
- xy(:,n) = [xi;yi];
- end
- xy(:,n+1) = xy(:,1);
- t = 1:n+1;
- ts = 1: 0.1: n+1;
- xys = spline(t,xy,ts);
- plot(xys(1,:),xys(2,:),'b-');
- hold off
- fid=fopen('data.txt','w');
- for k1=1:2
- for k2=1:n+1
- fprintf(fid,'%f ',xy(k1,k2));
- end
- fprintf(fid,'\n');
- end
- fclose(fid);
复制代码 |
|