|MATLAB Function Reference|
Convert to signed integer
I = int*(X)
converts the elements of array
X into signed integers.
X can be any numeric object (such as a
double). The results of an
int* operation are shown in the next table.
||Bytes per Element
||-128 to 127
||Signed 8-bit integer
||-32,768 to 32,767
||Signed 16-bit integer
||-2,147,483,648 to 2,147,483,647
||Signed 32-bit integer
||-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
||Signed 64-bit integer
single values are rounded to the nearest
int* value on conversion. A value of
X that is above or below the range for an integer class is mapped to one of the endpoints of the range. For example,
X is already a signed integer of the same class, then
int* has no effect.
You can define or overload your own methods for
int* (as you can for any object) by placing the appropriately named method in an
@int* directory within a directory on your path. Type
help datatypes for the names of the methods you can overload.
Most operations that manipulate arrays without changing their elements are defined for integer values. Examples are
size, the logical and relational operators, subscripted assignment, and subscripted reference.
Some arithmetic operations are defined for integer arrays on interaction with other integer arrays of the same class (e.g., where both operands are
int16). Examples of these operations are
.^. If at least one operand is scalar, then
^ are also defined. Integer arrays may also interact with scalar
double variables, including constants, and the result of the operation is an integer array of the same class. Integer arrays saturate on overflow in arithmetic.
A particularly efficient way to initialize a large array is by specifying the data type (i.e., class name) for the array in the
eye function. For example, to create a 100-by-100
int64 array initialized to zero, type
An easy way to find the range for any MATLAB integer type is to use the
intmax functions as shown here for
© 1994-2005 The MathWorks, Inc.