MATLAB Functions Help Desk

uint8

Purpose

Convert to unsigned 8-bit integer

Syntax

Description

i = uint8(x) converts the vector x into an unsigned 8-bit integer. x can be any numeric object (such as a double). The elements of an uint8 range from 0 to 255. The result for any elements of x outside this range is not defined (and may vary from platform to platform). If x is already an unsigned 8-bit integer, uint8 has no effect.

The uint8 class is primarily meant to store integer values. Most operations that manipulate arrays without changing their elements are defined (examples are reshape, size, subscripted assignment and subscripted reference). No math operations are defined for uint8 since such operations are ambiguous on the boundary of the set (for example they could wrap or truncate there). You can define your own methods for uint8 (as you can for any object) by placing the appropriately named method in an @uint8 directory within a directory on your path. The Image Processing Toolbox does just that to define additional methods for the uint8 (such as the logical operators <,>,&, etc.).

Type help oopfun for the names of the methods you can overload.

See Also

doubleConvert to double precision

[ Previous | Help Desk | Next ]