% 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