psztswcbyy
   “fread”以二进制形式,从文件读出数据。
语法1:[a,count]=fread(fid,size,precision)
语法2:[a,count]=fread(fid,size,precision,skip)
size:    不指定     :到尾返回读。
          N         : 读出N个数据,构成列向量。
          inf       : 读出fid指向的打开的文件的全部数据。
          [M,N]     : 读出N个数据,构成列向量,填入M*N矩阵
    precision(精度)
precision(精度)规定了以浮点数、整型数、字符读出时位。matlab 的precision(精度)的表达式与c语言、fortran语言、是一致的。不规定precision(精度),则字符默认为: ucher、则数值默认为:双精度 。
      以下precision(精度)将保证读出具有一致的体积。
MATLAB           C or Fortran             Descriphon(精度)
\'char\'               \'char*l\'                      8 位,字符型
\'uchar\'             \'unsigned char\'          8 位 
\'schar\'              \'signed char\'             8 位,字符型
\'int8\'                \'integer*1\'                8 位,整型数
\'intl6\'               \'integer*2\'                16 位,整型数.
\'int32\'              \'integer*4\'                32 位,整型数.
\'int64\'              \'integer*8\'                64 位,整型数
\'uint8\'              \'integer*l\'                 8 位 
\'uintl6\'             \'integer*2\'                16 位 
\'uint32\'            \'integer*4\'                32 位 
\'uint64\'            \'integer*8\'                64 位 
\'float32\'           \'real*4\'                   浮点数, 32 位
\'float64\'           \'real*8\'                   浮点数, 32 位
 
以下precision(精度)将不保证读出具有一致的体积。
MATLAB           C or Fortran            Descriphon(精度)
\'short\'              \'short\'                     16 位,整型数
\'int\'                  \'int\'                         32 位,整型数
\'long\'               \'long\'                       32 (64) 位,整型数
\'uShort\'           \'Unsigned short\'        16 位 
\'uint\'               \'Unsigned int\'            32 位 
\'ulong\'            \'unsigned long\'          32 (64) 位    
\'float\'              \'float\'                      浮点数, 32 位
\'double\'           \'double\'                  浮点数, 64 位
 
以下precision(精度)规定读出指定的体积n。
\'bitN\'          N位,整型数      1<=N<=64
\'ubitN\'         N位,            1<=N<=64

分类:

技术点:

相关文章: