Documentation Center

  • Trial Software
  • Product Updates

System Object Methods

What Are System Object Methods?

After you create a System object™, you use various object methods to process data or obtain information from or about the object. All methods that are applicable to an object are described in the reference pages for that object. System object method names begin with a lowercase letter and class and property names begin with an uppercase letter. The syntax for using methods is <method>(<handle>), such as step(H), plus possible extra input arguments.

System objects use a minimum of two commands to process data—a constructor to create the object and the step method to run data through the object. This separation of declaration from execution lets you create multiple, persistent, reusable objects, each with different settings. Using this approach avoids repeated input validation and verification, allows for easy use within a programming loop, and improves overall performance. In contrast, MATLAB® functions must validate parameters every time you call the function.

These advantages make System objects particularly well suited for processing streaming data, where segments of a continuous data stream are processed iteratively. This ability to process streaming data provides the advantage of not having to hold large amounts of data in memory. Use of streaming data also allows you to use simplified programs that use loops efficiently.

The Step Method

The step method is the key System object method. You use step to process data using the algorithm defined by that object. The step method performs other important tasks related to data processing, such as initialization and handling object states. Every System object has its own customized step method, which is described in detail on the step reference page for that object. For more information about the step method and other available methods, see the descriptions in Common Methods.

Common Methods

All System objects support the following methods, each of which is described in a method reference page associated with the particular object. In cases where a method is not applicable to a particular object, calling that method has no effect on the object.

MethodDescription
step

Processes data using the algorithm defined by the object. As part of this processing, it initializes needed resources, returns outputs, and updates the object states. After you call the step method, you cannot change any input specifications (i.e., dimensions, data type, complexity). During execution, you can change only tunable properties. The step method returns regular MATLAB variables.

Example: Y = step(H,X)

release

Releases any special resources allocated by the object, such as file handles and device drivers, and unlocks the object. For System objects, use the release method instead of a destructor.

resetResets the internal states of the object to the initial values for that object
getNumInputsReturns the number of inputs (excluding the object itself) expected by the step method. This number varies for an object depending on whether any properties enable additional inputs.
getNumOutputsReturns the number of outputs expected from the step method. This number varies for an object depending on whether any properties enable additional outputs.
getDiscreteStateReturns the discrete states of the object in a structure. If the object is unlocked (when the object is first created and before you have run the step method on it or after you have released the object), the states are empty. If the object has no discrete states, getDiscreteState returns an empty structure.
cloneCreates another object of the same type with the same property values
isLockedReturns a logical value indicating whether the object is locked.
isDoneApplies to source objects only. Returns a logical value indicating whether the step method has reached the end of the data file. If a particular object does not have end-of-data capability, this method value returns false.
infoReturns a structure containing characteristic information about the object. The fields of this structure vary depending on the object. If a particular object does not have characteristic information, the structure is empty.

Was this topic helpful?