% 07/2008 % David E. Haddad % This is an efficient version of the script "three_column_utility.m" that % is designed to clean very large datasets by loading a multi-column matrix from an % existing text file and exporting two 3-column text files (one for ArcMap with a % header, and another for P2G without a header). Greater efficiency is achieved % by processing reducing the number of copies of the dataset in memory. % IMPORTANT NOTE: You cannot use MATLAB's "load" command if your original data text % file has a header. MAKE SURE YOU DELETE THE HEADER! % Here we go... clear all % CHANGE THIS TO YOUR INPUT FILE NAME xyz_data = load('input_filename.txt'); % For P2G (doesn't need a header): dlmwrite('xyz_P2G.txt',xyz_data(:,1:3)); % comma delimited % For ArcMap (needs a header): fid = fopen('xyz_ArcMap.txt','w+t'); fprintf(fid,'x,y,z\n'); % writes headers to text file fclose(fid); dlmwrite('xyz_ArcMap.txt',xyz_data(:,1:3),'-append'); % comma delimited, % appends new xyz % matrix to text file