Error using dlmread- mismatch between file and format character vector (reading a ply file)
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to read in a ply file to matlab using the following code:
function fv = read_ply2_ExampleData(fileName)
% this function reads a ply file (must be in text format)
% to calc. normals etc use calcMeshNormals
% Copyright : This code is written by Ajmal Saeed Mian {ajmal@csse.uwa.edu.au}
% Computer Science, The University of Western Australia. The code
% may be used, modified and distributed for research purposes with
% acknowledgement of the author and inclusion this copyright information.
% Modified by Vipin Vijayan.
x = dlmread(fileName, ' ', [4 2 4 2]);
y = dlmread(fileName, ' ', [15 2 15 2]);
header = 18; %starting by row=0, the first row of data to be read starts here
vertex = dlmread(fileName, ' ', [header 0 x+(header-1) 9]);
poly = dlmread(fileName, ' ', [x+header 0 x+(header-1)+y 3]);
poly(:,1) = [];
poly = poly + 1;
fv.vertices = vertex;
fv.faces = poly;
I obtain the following error:
Error using dlmread
Mismatch between file and format character vector. Trouble reading 'Numeric' field from file (row number 1, field number 3) ==> by CloudCompare!\n
I have been able to read in other ply files using this code, I am not sure what I am missing this time. The ply file is a large point cloud ( about 6 000 000 points) that I converted to a ply file using CloudCompare.
댓글 수: 0
채택된 답변
Walter Roberson
2019년 6월 4일
Your ply file contains a comment in an unexpected place. If you look at the file in the place it contains "by CloudCompare" a number is expected. Possibly the code is expecting that the line ends at that point and that the next line starts with a number
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Other Formats에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!