int64
64-bit signed integer arrays
Description
Variables in MATLAB® of data type (class) int64
are stored as 8-byte
(64-bit) signed integers. For example:
y = int64(10);
whos y
Name Size Bytes Class Attributes y 1x1 8 int64
For more information on integer types, see Integers.
Creation
Some array creation functions allow you to specify the data type. For instance,
zeros(100,'int64')
creates a 100-by-100 matrix of zeros of type
int64
.
If you have an array of a different type, such as double
or
single
, then you can convert that array to an array of type
int64
by using the int64
function.
Syntax
Description
Input Arguments
Examples
Tips
When you create a numeric array of large integers (larger than
flintmax
), MATLAB initially represents the input as double precision by default. Precision can be lost when you convert this input to theint64
data type. To maintain precision, callint64
with each scalar element of the array instead. For example, see Convert Array of Large Integers Without Loss of Precision.If you have text formatted in a character array or string scalar that contains large integers, then you can read this text and return an accurate 64-bit signed integer array by using the
sscanf
function. You can specify the format of the input fields so thatsscanf
directly converts the text that represents integers in decimals, octals, or hexadecimals without first converting them to Unicode code values. For comparison,int64(X)
converts a character vector input to an integer array that represents the Unicode code values for each character.
Extended Capabilities
Version History
Introduced before R2006a