www.pudn.com > lidar.rar > decp.m, change:2010-06-07,size:1894b

```function [x,y,z]=decp(com)
% decompose the commix coordinate into x, y and z
[l,p]=size(com);
switch p
case 3
x=com(:,1);
y=com(:,2);
z=com(:,3);
case 6
x1=com(:,1);
y1=com(:,2);
z1=com(:,3);
x2=com(:,4);
y2=com(:,5);
z2=com(:,6);
x1=x1';
y1=y1';
z1=z1';
x2=x2';
y2=y2';
z2=z2';
x=[x1,x2];
y=[y1,y2];
z=[z1,z2];
x=x';
y=y';
z=z';
case 8
x1=com(:,1);
y1=com(:,2);
z1=com(:,3);
x2=com(:,5);
y2=com(:,6);
z2=com(:,7);
x1=x1';
y1=y1';
z1=z1';
x2=x2';
y2=y2';
z2=z2';
x=[x1,x2];
y=[y1,y2];
z=[z1,z2];
x=x';
y=y';
z=z';
otherwise
disp('the data is error')
end
com=[x,y,z];
dlmwrite('trans.txt',com ,'delimiter', ' ');

%fid=fopen('D:\MATLAB7\work\sy\trans1.txt','w')
%fwrite(fid,com,'single');
%fclose(fid);

%-------------------------
% 绘制三维曲面(meshgrid)
%-------------------------
%[XI,YI]=meshgrid(x,y);
%ZI=griddata(x,y,z,XI,YI);
%mesh(XI,YI,ZI)

%-------------------------
% 绘制三维曲面(delaunay)（矩阵太大，需要分块，1000以内）(ERROR)
%-------------------------
%[XI,YI]=meshgrid(x,y);
%ZI=griddata(x,y,z,XI,YI);
%XI1=XI(1:1000,1:1000);
%YI1=YI(1:1000,1:1000);
%tri2=delaunay(XI1,YI1);
%ZI1=ZI(1:1000,1:1000);
%trisurf(tri2,XI1,YI1,ZI1)
%XI2=XI(1001:1801,1001:1801);
%YI2=YI(1001:1801,1001:1801);
%ZI2=ZI(1001:1801,1001:1801);
%tri3=delaunay(XI2,YI2);
%hold on
%trisurf(tri3,XI2,YI2,ZI2)
%
%for i=1:40
%   for j=1:45
%       n=n+1;
%       xs(i,j)=x(n);
%       ys(i,j)=y(n);
%       zs(i,j)=z(n);
%   end
%end
%tri=delaunay(xs,ys);
%trisurf(tri,xs,ys,zs)```