uint32
Converts values to unsigned 32-bit integers (0 to 4294967295).
Category: Language Fundamentals > Data Types
Syntax
Y = uint32(X)
Converts X to class uint32.
Description
Values are rounded to the nearest integer (halves away from zero) and then saturate: anything above 4294967295 becomes 4294967295, and negative numbers and NaN become 0. No error or warning is raised. For example, uint32(5e9) gives 4294967295.
Arithmetic between uint32 and a double gives a uint32 result, rounded and saturated again, so uint32(7)/uint32(2) is 4. Mixing two different integer classes in one operation is an error. intmax('uint32') gives the largest value.
Input arguments
X- Numeric, logical or char array.
Output arguments
Y- Array of class
uint32with the same size asX.
Example
Rounding and saturation
uint32(5e9)
uint32(7)/uint32(2)
intmax('uint32')
Output
ans = uint32
4294967295
ans = uint32
4
ans = uint32
4294967295