Tuning System object Properties in MATLAB

Understand System object Modes

System objects are in one of two modes: unlocked or locked. After you create an object and until it starts processing data, that object is in unlocked mode. You can change any of its properties as desired.

The object initializes and locks when it begins processing data. The typical way in which an object becomes locked is when the step method is called on that object. To determine if an object is locked, use the isLocked method. To unlock an object, use the release method. When the object is locked, you cannot change any of the following:

  • Number of inputs or outputs

  • Data type

  • Dimensions of inputs or tunable properties, except for System objects that support variable-size data. Variable-size data is data whose size can change at run time. By contrast, fixed-size data is data whose size is known and locked at compile time and, therefore, cannot change at run time.

  • Value of any nontunable property

Several System objects do not allow changing the complexity of inputs from real to complex. You can, however, change the input complexity from complex to real without unlocking the object.

These restrictions allow the object to maintain states and allocate memory appropriately.

Change Properties While Running System Objects

When an object is in locked mode, it is processing data and you can only change the values of properties that are tunable. To determine if a particular System object™ property is tunable, see the corresponding reference page or use a command of this form:

help dsp.FFT.Normalize

  • dsp is the package name.

  • FFT is the object name.

  • Normalize is the property name.

    Note:   Unless otherwise specified, System object properties are not tunable.

For information on locked and unlocked modes, see Understand System object Modes.

Change System object Input Complexity or Dimensions

During simulations you can change an input's complexity from complex to real, but not from real to complex. You cannot change any input complexity during code generation.

For objects that do not support variable-size input, if you change the input dimensions while the object is in locked mode, the object produces a warning and unlocks. The object then reinitializes the next time you call the step method. See the object's reference page for more information. You can change the value of a tunable property and the input size without a warning or error being produced. For all other changes at runtime, an error occurs.

Was this topic helpful?