在MATLAB中建立一個腳本show3Dtxt.m文件,編寫代碼:
clear;
%%read 3D data
fileID= fopen('E:\博士\深度學習與三維重建\代碼實現\voxel_grids_64\chair_0890_0_0_1_062_049_042.txt','r');
%txt文件讀成三維元胞數組cell形式
A = textscan(fileID,'%d %d %d');
%X,Y,Z數據類型均為 1*1 cell
X=A(:,1);
Y=A(:,2);
Z=A(:,3);
%將元胞數組轉化為矩陣形式
x=cell2mat(X);
y=cell2mat(Y);
z=cell2mat(Z);
%%show 3D data
plot3(x,y,z,'ro'); %紅色圓點
xlabel('x軸'),ylabel('y軸'),zlabel('z軸')
grid on
運行代碼:

備注:voxel_grids_64\chair_0890_0_0_1_062_049_042.txt:

