Main Content

Resize `coder.Type`

object

returns a modified copy of `t_out`

= coder.resize(`t`

,`sz`

,`variable_dims`

)`coder.Type`

`t`

with (upper-bound) size `sz`

and variable dimensions
`variable_dims`

. If `variable_dims`

or `sz`

are scalars, the function applies the scalars to all
dimensions of `t`

. By default, `variable_dims`

does not apply
to dimensions where `sz`

is `0`

or `1`

, which
are fixed. Use the 'uniform' option to override this special case. The
`coder.resize`

function ignores `variable_dims`

for
dimensions with size `inf`

. These dimensions are variable size.
`t`

can be a cell array of types, in which case,
`coder.resize`

resizes all elements of
the cell array.

changes `t_out`

= coder.resize(`t`

,[],`variable_dims`

) `t`

to have variable dimensions `variable_dims`

while
leaving the size unchanged.

resizes `t_out`

= coder.resize(`t`

,`sz`

,`variable_dims`

,`Name,Value`

)`t`

by using additional options specified by one or more Name, Value
pair arguments.

resizes the individual dimensions of `t_out`

= coder.resize(`t`

,'sizelimits',`limits`

)`t`

based on the threshold values in the
`limits`

vector. The `limits`

vector is a row vector
containing two positive integer elements. Each dimension of `t`

is individually
resized according to the thresholds in the `limits`

vector.

When the size

`S`

of a dimension is lesser than both thresholds defined in`limits`

, the dimension remains the same.When the size

`S`

of a dimension is greater than or equal to the first threshold and less than the second threshold defined in`limits`

, the dimension becomes variable size with upper bound`S`

.However, when the size

`S`

of a dimension is also greater than or equal to the second threshold defined in`limits`

, the dimension becomes an unbounded variable size.

If the value of `limits`

is scalar, the threshold gets scalar-expanded to
represent both thresholds. For example, if `limits`

is defined as
`4`

, it is interpreted as `[4 4]`

.

The `'sizelimits'`

option allows you to dynamically allocate memory to
large arrays in your generated code.

For sparse matrices,

`coder.resize`

drops the upper bounds for variable-size dimensions.