%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function formatElevData() : Writes matrix as ascii text to file. % data formatted as xxx.xx % (see %6.2 in fprintf statement) % % INPUT : m x n matrix, name of file to write to. % OUTPUT: NONE % % Author: Jason Tate June 10, 1998 % tate@edcenter.sdsu.edu % % Educational Center for Computational Science & Engineering % http://www.edcenter.sdsu.edu % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function formatElevData(ElevationMatrix,filename) % DETERMINE DIMENSIONS OF MATRIX Dimensions = size(ElevationMatrix); numRows = Dimensions(1); numColumns = Dimensions(2); % OPEN FILE TO WRITE MATRIX TO fp = fopen(filename,'w'); for i = 1:numRows for j = 1:numColumns fprintf(fp,'%6.2f,',ElevationMatrix(i,j) ); end fprintf(fp,'\n'); end fclose(fp);