给我matlab读取五组txt点云坐标并用不同颜色显示的代码
时间: 2023-03-28 09:02:41 浏览: 90
以下是 Matlab 读取五组 txt 点云坐标并用不同颜色显示的代码:
clear all;
close all;
clc;
% 读取五组 txt 文件
file1 = 'file1.txt';
file2 = 'file2.txt';
file3 = 'file3.txt';
file4 = 'file4.txt';
file5 = 'file5.txt';
data1 = load(file1);
data2 = load(file2);
data3 = load(file3);
data4 = load(file4);
data5 = load(file5);
% 绘制点云
figure;
hold on;
% 绘制第一组点云
scatter3(data1(:,1), data1(:,2), data1(:,3), 10, 'r', 'filled');
% 绘制第二组点云
scatter3(data2(:,1), data2(:,2), data2(:,3), 10, 'g', 'filled');
% 绘制第三组点云
scatter3(data3(:,1), data3(:,2), data3(:,3), 10, 'b', 'filled');
% 绘制第四组点云
scatter3(data4(:,1), data4(:,2), data4(:,3), 10, 'm', 'filled');
% 绘制第五组点云
scatter3(data5(:,1), data5(:,2), data5(:,3), 10, 'y', 'filled');
% 设置坐标轴标签
xlabel('X');
ylabel('Y');
zlabel('Z');
% 设置图像标题
title('五组点云坐标');
% 显示图像
grid on;
axis equal;
hold off;
阅读全文