home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / IOFUN.DI$ / FSCANF.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  2.2 KB  |  46 lines

  1. %FSCANF    Read formatted data from file.
  2. %    [A,COUNT] = FSCANF(FID,FORMAT,SIZE) reads data from the file specified
  3. %    by file identifier FID, converts it according to the specified FORMAT
  4. %    string, and returns it in matrix A. COUNT is an optional output
  5. %    argument that returns the number of elements successfully read. 
  6. %    
  7. %    FID is an integer file identifier obtained from FOPEN.
  8. %    
  9. %       SIZE is optional; it puts a limit on the number of elements that
  10. %       can be read from the file; if not specified, the entire file 
  11. %       is considered; if specified, valid entires are:
  12. %           N      read at most N elements into a column vector.
  13. %           inf    read at most to the end of the file.
  14. %           [M,N]  read at most M * N elements filling at least an
  15. %                  M-by-N matrix, in column order. N can be inf, but not M.
  16. %
  17. %    FORMAT is a string containing C language conversion specifications.
  18. %    Conversion specifications involve the character %, optional
  19. %    assignment-suppressing asterisk and width field, and conversion
  20. %    characters d, i, o, u, x, e, f, g, s, c, and [. . .] (scanset).
  21. %    Complete ANSI C support for these conversion characters is
  22. %    provided consistent with 'expected' MATLAB behavior. For a complete
  23. %    conversion character specification, see a C manual.
  24. %
  25. %       If a conversion character s is used an element read may cause
  26. %       several MATLAB matrix elements to be used, each holding one
  27. %    character.
  28. %
  29. %       Mixing character and numeric conversion specifications will cause
  30. %       the resulting matrix to be numeric and any characters read to show
  31. %       up as their ASCII values one character per MATLAB matrix element.
  32. %
  33. %    FSCANF differs from its C language namesake in an important respect -
  34. %    it is "vectorized" in order to return a matrix argument. The format
  35. %    string is recycled through the file until an end-of-file is reached
  36. %    or the amount of data specified by SIZE is read in.
  37. %
  38. %    Examples:
  39. %        S = fscanf(fid,'%s')   reads (and returns) a character string.
  40. %        A = fscanf(fid,'%5d')  reads 5-digit decimal integers.
  41. %
  42. %    See also FPRINTF, SSCANF, FREAD.
  43.  
  44. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  45. %    Built-in function.
  46.