Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

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. The syntax for using methods is <method>(<system object name>), plus possible extra input arguments. For example, for txfourier = dsp.FFT, where txfourier is a name you assign, you call the reset method using reset(txfourier). For more information about methods, see the descriptions in Common Methods.

Running a System Object

To run a System object and perform the operation defined by its algorithm, you call the object as if it were a function. For example, to create an FFT object that uses the dsp.FFT System object, specifies a length of 1024, and names it dft, use

dft = dsp.FFT;
To run this object on input x, use
dft(x);
If you run a System object without any input arguments, you must include empty parentheses. For example, asysobj().

When you run a System object, it also performs other important tasks related to data processing, such as initialization and handling object states.

    Note:   An alternative way to run a System object is to use the step method. For example, for an object created using dft = dsp.FFT, you can run it using step(dft,x).

Common Methods

All System objects support the following methods, each of which is linked from each object's reference page. In cases where a method is not applicable to a particular object, calling that method has no effect on the object.

MethodDescription
Run System object like a function, or
step

Run the object to process data using the algorithm defined by that object.

Example: For dft = dsp.FFT;, the standard way to run the object is y = dft(x). The alternative way is y = step(dft,x).

As part of this processing, the object initializes needed resources, returns outputs, and updates the object states. After you start running the object, you cannot change any input specifications (i.e., dimensions, data type, complexity). During execution, you can change only tunable properties. Both ways of running a System object return regular MATLAB® variables.

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 a locked object to the initial values for that object and leaves the object locked
getNumInputsReturns the number of inputs (excluding the object itself) expected running the object. This number varies for an object depending on whether any properties enable additional inputs.
getNumOutputsReturns the number of outputs expected from running the object. 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 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 end of the data file has been reached. 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.

For a complete list of methods for writing new System objects, see System Objects Methods for Defining New Objects.

Was this topic helpful?