Binary Representation of Numbers in Matlab

版本 1.0.0.0 (58.5 KB) 作者: Munther
To learn how numbers are represented and stored in Matlab memory.
204.0 次下载
更新时间 2011/11/1

查看许可证

When we represent numbers, we use digits 0 to 9 and a decimal point. When a computer represents numbers, it uses 0 and 1 digits, and we refer to this as binary representation of numbers.
As mentioned earlier, numbers can be classified into integer numbers and real numbers. Both types are represented by a computer differently. Even though, there are different representations for each type. For example, Matlab supports eight data types to represent integer numbers and two data types to represent real numbers. Matlab documentations refer to data types as classes. We will use both terms interchangeably in this lesson.
The data types Matlab supports to represent integer numbers are: uint8, uint16, uint32, uint64, int8, int16, int32 and int64. The data types Matlab supports to represent real numbers are: single and double.

The letter ‘u’ in the uint8, uint16, uint32, uint64 refers to unsigned data type. These classes can only store positive integer numbers.

Matlab allows you to change the values of bits for the classes uint8, uint16, uint32, uint64 only. Studying the binary representation of these classes is the most important part of this tutorial.
Matlab supports other data formats such as fractional, fixed point, and user defined float data types. These data types will not be discussed in this tutorial.

引用格式

Munther (2024). Binary Representation of Numbers in Matlab (https://www.mathworks.com/matlabcentral/fileexchange/33557-binary-representation-of-numbers-in-matlab), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2010b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Logical 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0