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

  1. %FREAD    Read binary data from file.
  2. %    [A, COUNT] = FREAD(FID,SIZE,PRECISION) reads binary data from the
  3. %    specified file and writes it into matrix A.  If COUNT is used,
  4. %    FREAD returns the number of elements successfully read. 
  5. %    
  6. %    FID is an integer file identifier obtained from FOPEN, or 0 for
  7. %    standard input.
  8. %    
  9. %    The size argument is optional; if not specified, the entire
  10. %    file is read; if specified, valid entries are:
  11. %        N      read N elements into a column vector.
  12. %        inf    read to the end of the file.
  13. %        [M,N]  read elements to fill an M-by-N matrix, in column order.
  14. %    
  15. %    The precision argument controls the number of bits read for each value
  16. %    and the interpretation of those bits as character, integer or floating
  17. %    point values.  Any of the following strings, either the MATLAB
  18. %    versions, or their C or Fortran equivalents, may be used.  If not
  19. %    specified, the default is 'uchar'.  In all cases, the resulting matrix
  20. %    elements are stored as long floating point values, as is all other
  21. %    MATLAB data.
  22. %    
  23. %        MATLAB    C or Fortran      Description
  24. %    
  25. %        'char'    'char'            character,  8 bits
  26. %        'schar'   'signed char'     signed character,  8 bits
  27. %        'short'   'short'           integer,  16 bits
  28. %        'int'     'int'             integer,  16 or 32 bits
  29. %        'long'    'long'            integer,  32 bits
  30. %        'float'   'float'           floating point,  32 bits
  31. %        'double'  'double'          long floating point,  64 bits
  32. %        'uchar'   'unsigned char'   unsigned character,  8 bits
  33. %        'ushort'  'unsigned short'  unsigned integer,  16 bits
  34. %        'uint'    'unsigned int'    unsigned integer,  16 or 32 bits
  35. %        'ulong'   'unsigned long'   unsigned integer,  32 bits
  36. %    
  37. %        'char'    'char*1'          character,  8 bits
  38. %        'float32' 'real*4'          32 bit floating point
  39. %        'float64' 'real*8'          64 bit floating point
  40. %        'int8'    'integer*1'       integer, 8 bits.
  41. %        'int16'   'integer*2'       integer, 16 bits.
  42. %        'int32'   'integer*4'       integer, 32 bits.
  43. %    
  44. %         'intN'                     signed integer, N bits wide
  45. %         'uintN'                    unsigned integer, N bits wide
  46. %    
  47. %         where N represents any value between 1 and 32.
  48. %
  49. %    Example:
  50. %
  51. %        fid = fopen('fread.m','r');
  52. %        F = fread(fid);
  53. %        s = setstr(F')
  54. %
  55. %    opens the file containing this HELP entry, then reads and displays
  56. %    the entire file, using default size = inf and precision = 'uchar'.
  57. %    The resulting length(F) is the number of characters in the file.
  58. %
  59. %    NOTE: The only supported precisions for Cray data are
  60. %          'char', 'schar', 'uchar', 'float', 'double', and 'float64'.
  61. %
  62. %    See also FSCANF, LOAD.
  63.  
  64. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  65. %    Built-in function.
  66.