Main Content
cast
Cast variable to different data type
Syntax
Description
Examples
Input Arguments
Tips
Using the b = cast(a,'like',p)
syntax to
specify data types separately from algorithm code allows you to:
Reuse your algorithm code with different data types.
Keep your algorithm uncluttered with data type specifications and switch statements for different data types.
Improve readability of your algorithm code.
Switch between fixed-point and floating-point data types to compare baselines.
Switch between variations of fixed-point settings without changing the algorithm code.
Version History
Introduced in R2013a