function writetofilepri(prifile, outpath, namestr) fid = fopen([outpath '\' namestr '.PRI'],'w'); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C> * SBEACH initial profile input file: %s.PRI *\r\n',namestr); fprintf(fid,'C> *******************************************************\r\n'); fprintf(fid,'C>\r\n'); fprintf(fid,'C>\r\n'); fprintf(fid,'C> NUMBER OF POINTS\r\n'); fprintf(fid,'C> POSITION (m or ft), ELEVATION (m or ft)\r\n'); fprintf(fid,'E>----------------------------------------------------------------\r\n'); fprintf(fid,'%d\r\n',length(prifile)); for ii = 1:length(prifile) if ii == length(prifile) fprintf(fid,'%.3f %.3f\r\n', prifile(ii,1),prifile(ii,2)); else fprintf(fid,'%.3f %.3f\r\n', prifile(ii,1),prifile(ii,2)); end end fclose(fid); end