iconvert
conversion to 1 to 8 byte integer representation
Syntax
y = iconvert(X, itype)
Arguments
- X
- a matrix of decimal numbers, encoded integers, or booleans. Complex numbers are not supported. 
- itype
- an integer: conversion code 
- y
- matrix of integers encoded on 1, 2, 4 or 8 bytes, with the sizes of - X:- y(i)is- X(i)converted into the chosen encoding.
Description
The iconvert function converts and stores data to 1, 2, 4 or
            8 bytes integers. Please refer to the int8() page for a
            detailled description.
| itype | y typeof | range | 
|---|---|---|
| 0 | (reals) | |
| 1 | int8 | [-128, 127] | 
| 2 | int16 | [-32768, 32767] | 
| 4 | int32 | [-2147483648, 2147483647] | 
| 8 | int64 | [-9223372036854775808, 9223372036854775807] | 
| 11 | uint8 | [0, 255] | 
| 12 | uint16 | [0, 65535] | 
| 14 | uint32 | [0, 4294967295] | 
| 18 | uint64 | [0, 18446744073709551615] | 
|  | Converting  []always keeps it as is, of type 1 == inttype 0
           (decimal type). | 
Examples
iconvert([-3.6 -2.5 -1.2 1.2 2.5 3.6], 1) iconvert([-%inf %inf %nan], 1) iconvert([-%inf %inf %nan], 11) iconvert(-1, 11) iconvert(-1, 12) iconvert(-1, 14) iconvert(-1, 18)
--> iconvert([-3.6 -2.5 -1.2 1.2 2.5 3.6], 1) ans = -3 -2 -1 1 2 3 --> iconvert([-%inf %inf %nan], 1) ans = -128 127 0 --> iconvert([-%inf %inf %nan], 11) ans = 0 255 0 --> iconvert(-1, 11) ans = 255 --> iconvert(-1, 12) ans = 65535 --> iconvert(-1, 14) ans = 4294967295 --> iconvert(-1, 18) ans = 18446744073709551615
See also
History
| Version | Description | |||||||||||||||||||||
| 6.0 | 
 | 
| Report an issue | ||
| << Integers | Integers | int8 >> |