| Contents | Index |
intArray = uint8(array)
intArray = uint8(array) converts the elements of an array into unsigned 8-bit (1-byte) integers of class uint8.
array |
Array of any numeric class, such as single or double. If array is already of class uint8, the uint8 function has no effect. |
Convert a double array to uint8:
mydata = uint8(magic(10));
When preallocating integer arrays, specify the class in the call to functions that support a class name input (such as zeros, ones or eye), rather than calling an integer conversion function. For example,
I = uint8(zeros(100)); % Creates an intermediate array
is not as efficient as
I = zeros(100, 'uint8'); % Preferred
double | int16 | int32 | int64 | int8 | intmax | intmin | single | uint16 | uint32 | uint64

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |