Main Content

Create array of all zeros with fixed-point properties

`X = zeros('like',`

returns
a scalar `p`

)`0`

with the same `numerictype`

,
complexity (real or complex), and `fimath`

as `p`

.

`X = zeros(`

returns
an `sz1,...,szN`

,'like',`p`

)`sz1`

-by-...-by-`szN`

array of
zeros like `p`

.

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.