16-bit unsigned integer arrays
Variables in MATLAB® of data type (class)
uint16 are stored as
2-byte (16-bit) unsigned integers. For example:
y = uint16(10); whos y
Name Size Bytes Class Attributes y 1x1 2 uint16
For more information on integer types, see Integers.
Some array creation functions allow you to specify the data type. For instance,
zeros(100,'uint16') creates a 100-by-100 matrix of zeros of type
If you have an array of a different type, such as
single, then you can convert that array to an array of type
uint16 by using the
X— Input array
Input array, specified as a scalar, vector, matrix, or multidimensional array.
Convert a double-precision variable to a 16-bit unsigned integer.
x = 100; xtype = class(x)
xtype = 'double'
y = uint16(x)
y = uint16 100
This function fully supports tall arrays. For more information, see Tall Arrays.
backgroundPoolor accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).