Single-precision variables in MATLAB® are stored as 4-byte (32-bit) floating-point values of data type (class)
single. For example:
y = single(10); whos y
Name Size Bytes Class Attributes y 1x1 4 single
For more information on floating-point values, see Floating-Point Numbers.
If you have an array of a different type, such as
int8, then you can convert that array to single precision using the
X— Input array
Input array, specified as a scalar, vector, matrix, or multidimensional array.
Convert a double-precision variable to single precision with the
x = 100; xtype = class(x)
xtype = 'double'
y = single(x)
y = single 100
This function fully supports tall arrays. For more information, see Tall Arrays.
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).