MATLAB fread读整数,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

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值