dicomrt_nASCIIlines.m 359 B

1234567891011121314151617
  1. function [nlines] = dicomrt_nASCIIlines(filename)
  2. % dicomrt_nASCIIlines(filename)
  3. %
  4. % Returns the number of lines in an ASCII file.
  5. %
  6. % Copyright (C) 2002 Emiliano Spezi (emiliano.spezi@physics.org)
  7. fid=fopen(filename);
  8. nlines = 0;
  9. while 1
  10. if feof(fid)
  11. break;
  12. end
  13. nlines = nlines+1;
  14. fgetl(fid);
  15. end
  16. fclose(fid);