Main Content

Numeric Types

整数和浮点数据

MATLAB中的数字类®包括签名和无符号整数,单精度和双精度浮点数。默认情况下,Matlab将所有数值存储为双精度浮点。(您无法更改默认类型和精度。)您可以选择将任何数字或数字数组存储为整数或单数或单精度。整数和单精度阵列提供比双精度更多的内存高效存储。

所有数字类型都支持基本阵列操作,例如金宝app索引,重塑和数学操作。

职能

展开全部

双倍的 Double-precision arrays
单身的 单精度阵列
INT8. 8位符号整数阵列
int16 16-bit signed integer arrays
INT32. 32位符号整数阵列
INT64. 64位符号整数阵列
uint8. 8位无符号整数阵列
uint16 16位无符号整数阵列
UINT32 32位无符号整数阵列
UINT64 64位无符号整数阵列
投掷 将变量转换为不同的数据类型
typeCast. 转换数据类型而不更改底层数据
Isinteger. Determine whether input is integer array
isfloat. 确定输入是否是浮点数组
isnumeric. Determine whether input is numeric array
是真实的 确定数组是否使用复杂存储
是一菲特 Determine which array elements are finite
isinf 确定哪些数组元素是无限的
isnan. 确定哪些数组元素是南
EPS. 浮点相对准确性
Flintmax. 浮点格式最大的连续整数
Inf 创建所有的数组Infvalues
intmax. 最大的特定整数类型值
intmin Smallest value of specified integer type
创建所有的数组values
realmax. 最大的积极浮点数
realmin Smallest normalized floating-point number

话题

浮点数字

MATLAB表示双精度或单精度格式的浮点数。默认为双精度。

单精度数学

此示例显示如何使用单精度数据执行算术和线性代数。

整数

MATLAB支金宝app持整数数据的1 - ,2 - ,4-和8字节存储。如果使用满足数据的最小整数类型,则可以节省内存和程序执行时间。

整数算术

此示例显示如何在整数数据上执行表示信号和图像的算术。

创建复数

创建复杂数字。复数组成的实体部分和虚部。

无限和纳米

马铃薯草represents infinity by the special valueinf,并且既不是实际价值也不复杂的值,它代表“不是数字”。

识别数字类

您可以使用这些命令中的任何命令检查变量的数据类型。

数字值的显示格式

使用format函数或设置首选项以控制数字值的显示。

与整数类型不同

If you combine different integer types in a matrix (e.g., signed with unsigned, or 8-bit integers with 16-bit integers), all elements of the resulting matrix are given the data type of the leftmost element.

组合整数和非整数数据

If you combine integers with双倍的单身的, 要么逻辑类,得到的矩阵的所有元素都被赋予最左边的整数的数据类型。

空矩阵

如果使用空矩阵元素构造矩阵,则在生成的矩阵中忽略空矩阵。

串联示例

These examples show how to concatenate different data types.

十六进制和二进制值

Specify hexadecimal and binary values either as literals or as text. Hexadecimal and binary literals are stored as integers. You can convert text representing hexadecimal and binary values to numbers, and numbers to text representations.