• MATLAB小记_fread的用法


       “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
  • 相关阅读:
    SpringBoot/SpringMVC Restful接口全局异常处理
    spring/springboot/springmvc启用GZIP压缩
    centos7启动SonarQube 8.6报错
    类型初始值设定项引发异常
    OCI is not properly installed on this machine (NOE1/INIT)
    动态调用webservice 此 XML 文档中禁用 DTD。
    系统缺少插件 系统插件已过期
    几种常见的函数
    MQTT 协议基本介绍
    etcd:从应用场景到实现原理的全方位解读【修订版】
  • 原文地址:https://www.cnblogs.com/psztswcbyy/p/7450250.html
Copyright © 2020-2023  润新知