Construct quantizer
object
q = quantizer
q = quantizer('PropertyName1',PropertyValue1,...)
q = quantizer(PropertyValue1,PropertyValue2,...)
q = quantizer(struct)
q = quantizer(pn,pv)
q = quantizer
creates a quantizer
object
with properties set to their default values. To use this object to
quantize values, use the quantize method.
q = quantizer('PropertyName1',PropertyValue1,...)
uses
property name/ property value pairs.
q = quantizer(PropertyValue1,PropertyValue2,...)
creates
a quantizer
object with the listed property values.
When two values conflict, quantizer
sets the last
property value in the list. Property values are unique; you can set
the property names by specifying just the property values in the command.
q = quantizer(struct)
, where struct
is
a structure whose field names are property names, sets the properties
named in each field name with the values contained in the structure.
q = quantizer(pn,pv)
sets the named properties
specified in the cell array of character vectors pn
to
the corresponding values in the cell array pv
.
The quantizer
object property values are
listed below. These properties are described in detail in quantizer Object Properties.
Property Name | Property Value | Description |
---|---|---|
|
| Double-precision mode. Override all other parameters. |
| Custom-precision floating-point mode. | |
| Signed fixed-point mode. | |
| Single-precision mode. Override all other parameters. | |
| Unsigned fixed-point mode. | |
|
| Round toward positive infinity. |
| Round to nearest integer with ties rounding to nearest even integer. | |
| Round toward zero. | |
| Round toward negative infinity. | |
| Round to nearest integer with ties rounding toward positive infinity. | |
| Round to nearest integer with ties rounding to nearest integer with greater absolute value. | |
|
| Saturate on overflow. |
| Wrap on overflow. | |
|
| Format for |
| Format for float mode. |
The default property values for a quantizer
object
are
DataMode = fixed RoundMode = floor OverflowMode = saturate Format = [16 15]
Along with the preceding properties, quantizer
objects
have read-only states: max
, min
, noverflows
, nunderflows
,
and noperations
. They can be accessed through quantizer/get
or q.maxlog
, q.minlog
, q.noverflows
, q.nunderflows
,
and q.noperations
, but they cannot be set. They
are updated during the quantizer/quantize
method,
and are reset by the resetlog
function.
The following table lists the read-only quantizer
object
states:
Property Name | Description |
---|---|
| Maximum value before quantizing |
| Minimum value before quantizing |
| Number of overflows |
| Number of underflows |
| Number of data points quantized |
The following example operations are equivalent.
Setting quantizer
object properties by listing
property values only in the command,
q = quantizer('fixed', 'Ceiling', 'Saturate', [5 4])
Using a structure struct
to set quantizer
object
properties,
struct.mode = 'fixed'; struct.roundmode = 'ceil'; struct.overflowmode = 'saturate'; struct.format = [5 4]; q = quantizer(struct);
Using property name and property value cell arrays pn
and pv
to
set quantizer
object properties,
pn = {'mode', 'roundmode', 'overflowmode', 'format'}; pv = {'fixed', 'ceil', 'saturate', [5 4]}; q = quantizer(pn, pv)
Using property name/property value pairs to configure a quantizer
object,
q = quantizer( 'mode', 'fixed','roundmode','ceil',... 'overflowmode', 'saturate', 'format', [5 4]);
assignmentquantizer
| fi
| fimath
| fipref
| numerictype
| quantize
| quantizenumeric
| set
| unitquantize
| unitquantizer