cast - Cast variable to different data type

Syntax

B = cast(A, newclass)

Description

B = cast(A, newclass) casts A to class newclass. A must be convertible to class newclass. newclass must be the name of one of the built in data types.

Examples

a = int8(5);
b = cast(a,'uint8');
class(b)

ans =

uint8

See Also

class

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS