给我matlab读取几组txt点云坐标并用不同颜色显示的代码
时间: 2023-03-28 16:02:38 浏览: 103
以下是 Matlab 读取几组 txt 点云坐标并用不同颜色显示的代码:
clear all; close all; clc;
% 读取 txt 文件
file1 = 'pointcloud1.txt';
file2 = 'pointcloud2.txt';
file3 = 'pointcloud3.txt';
data1 = load(file1);
data2 = load(file2);
data3 = load(file3);
% 绘制点云
figure;
scatter3(data1(:,1), data1(:,2), data1(:,3), 10, 'r', 'filled');
hold on;
scatter3(data2(:,1), data2(:,2), data2(:,3), 10, 'g', 'filled');
scatter3(data3(:,1), data3(:,2), data3(:,3), 10, 'b', 'filled');
xlabel('X');
ylabel('Y');
zlabel('Z');
legend('Point Cloud 1', 'Point Cloud 2', 'Point Cloud 3');
grid on;
希望能对你有所帮助!
阅读全文