You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
552 B

% xyz format:
% cx cy cz nx ny nz
function [pnts, norms] = read_xyz(file)
if ~exist(file,'file')
error(['File ''%s'' not found. If the file is not on MATLAB''s path' ...
', be sure to specify the full path to the file.'], file);
end
fid = fopen(file,'r');
if ~isempty(ferror(fid))
error(lasterror); %#ok
end
fileID = fopen(file,'r');
tmp = fscanf(fileID,'%f');
fclose(fid);
xyz = reshape(tmp,6,[]);
xyz = xyz';
pnts = xyz(:,1:3);
norms = xyz(:,4:6);
end