Cast variable to different data type
B = cast(A,newclass)
B = cast(A,'like',p)
B = cast(A,newclass)
converts A
to
class newclass
, where newclass
is
the name of a built-in data type compatible with A
.
The cast
function truncates any values in A
that
are too large to map into newclass
.
B = cast(A,'like',p)
converts A
to
the same data type and sparsity as the variable p
.
If A
and p
are both real, then B
is
also real. Otherwise, B
is complex.