matlab.System class
Base class for System objects
Description
matlab.System
is the base class for System objects. In
your class definition file, you must subclass your object from this base class (or from
another class that derives from this base class). Subclassing allows you to use the
implementation methods and service methods provided by this base class to build your
object. Type this syntax as the first line of your class definition file to directly
inherit from the matlab.System
base class, where ObjectName
is the name of your
object:
classdef ObjectName < matlab.System
Note
You must set Access = protected
for each matlab.System
method you use in your code.
The matlab.System
class is a handle
class.
Class Attributes
Abstract | true |
HandleCompatible | true |
StrictDefaults | false |
For information on class attributes, see Class Attributes.
Methods
Authoring Methods (Protected)
getNumInputsImpl | Number of inputs to the System object |
isInputDataTypeMutableImpl | Set whether System object input data type can change |
isInputSizeMutableImpl | Set whether System object input size can change |
isInputComplexityMutableImpl | Set whether System object input complexity can change |
isInputDirectFeedthroughImpl | Direct feedthrough status of input |
getInputDimensionConstraintImpl | Define input dimension constraints for dataflow subsystems |
getNumOutputsImpl | Number of outputs from System object |
getOutputDataTypeImpl | Data types of output ports |
getOutputSizeImpl | Sizes of output ports |
isOutputComplexImpl | Complexity of output ports |
isOutputFixedSizeImpl | Fixed- or variable-size output ports |
getOutputDimensionConstraintImpl | Define output dimension constraints for dataflow subsystems |
getDiscreteStateSpecificationImpl | Discrete state size, data type, and complexity |
isDiscreteStateSpecificationMutableImpl | Control whether discrete states can change data type |
getDiscreteStateImpl | Discrete state property values |
getSampleTimeImpl | Specify sample time type, offset time, and sample time |
allowModelReferenceDiscreteSampleTimeInheritanceImpl | Model reference sample time inheritance status for discrete sample times |
getGlobalNamesImpl | Global variable names for MATLAB System block |
getInterfaceImpl (Simulink) | Set System object as message or data |
isTunablePropertyDataTypeMutableImpl | Set whether tunable properties can change data type |
isDoneImpl | End-of-data flag |
getSimulateUsingImpl | Specify value for Simulate using parameter |
getSimulinkFunctionNamesImpl | Register Simulink function names used in your System object |
showFiSettingsImpl | Fixed point data type tab visibility for System objects |
supportsMultipleInstanceImpl | Support System object in Simulink For Each subsystem |
getImpulseResponseLengthImpl | Define length of input effects for dataflow subsystems |
getPropertyGroupsImpl | Property groups for System object display |
showSimulateUsingImpl | Visibility of Simulate using parameter |
getIconImpl | Name to display as block icon |
getHeaderImpl | Header for System object display |
getInputNamesImpl | Names of MATLAB System block input ports |
getOutputNamesImpl | Names of MATLAB System block output ports |
isInactivePropertyImpl | Status of inactive property |
setupImpl | Initialize System object |
stepImpl | System output and state update equations |
resetImpl | Reset System object states |
releaseImpl | Release resources |
processTunedPropertiesImpl | Action when tunable properties change |
validatePropertiesImpl | Validate property values of System object |
processInputSpecificationChangeImpl | Perform actions when input size, complexity, or data type change |
validateInputsImpl | Validate inputs to System object |
updateImpl | Update object states based on inputs |
loadObjectImpl | Load System object from MAT file |
saveObjectImpl | Save System object in MAT file |
infoImpl | Information about System object |
Query Functions (Protected)
setProperties | Set property values using name-value pairs when creating System object |
propagatedInputComplexity | Complexity of input during Simulink propagation |
propagatedInputDataType | Data type of input during Simulink propagation |
propagatedInputFixedSize | Fixed-size status of input during Simulink propagation |
propagatedInputSize | Size of input during Simulink propagation |
createSampleTime | Create sample time specification object |
getSampleTime | Query sample time |
getCurrentTime | Current simulation time in MATLAB System block |
setNumTicksUntilNextHit (Simulink) | Set the number of ticks in Simulink sample time |
displayScalarObject | Display format for scalar objects |
getHeader | Build and return display header text |
getFooter | Build and return display footer text |
Implementation Methods (Public)
nargin | Number of input arguments for System object |
nargout | Number of output arguments for System object |
getNumInputs | Number of inputs required to call the System object |
getNumOutputs | Number of outputs from calling the System object |
setup | One-time set up tasks for System objects |
reset | Reset internal states of System object |
step | Run System object algorithm |
release | Release resources and allow changes to System object property values and input characteristics |
clone | Create duplicate System object |
isDone | End-of-data status |
isLocked | Determine if System object is in use |
Examples
Create Basic System Object
This example shows how to author a basic System object called AddOne
.
In MATLAB, select New > System object > Basic. A new editor window opens with default syntax and comments for a new System object.
Rename the class AddOne
. Modify the default template so your class looks like this:
classdef AddOne < matlab.System % ADDONE Compute an output value that increments the input by one methods (Access = protected) % Implement algorithm. Calculate y as a function of input x. function y = stepImpl(~,x) y = x + 1; end end end
Use this object by creating an instance of AddOne
and running the object with input.
addingObject = AddOne; x = 5; addingObject(x)
ans = 6
More About
Attributes
You can apply attributes to the System object™ class and properties. To learn more about attributes, see Class Attributes or Property Attributes.
This table shows attributes that you can apply to the MATLAB® System object class.
Attribute Name | Description |
StrictDefaults | Control the defaults for the methods that restrict specification modifications changes:
By default, these methods return
For System objects used in Simulink®, this attribute only restricts input size changes because Simulink already restricts complexity and data type for tunable properties, inputs, and states. |
Specify the class attribute value in parentheses followed by the class name, for example:
classdef (StrictDefaults) MySystemObject < matlab.System
You can apply the following attributes to any property of a custom System object.
Nontunable | Use Nontunable to prevent changes to a property
value while the object is in use. By default, all properties are tunable.
The Nontunable attribute is useful to lock down a
property that has side effects when changed. This attribute is also
useful for locking a property value assumed to be constant during
processing. You should always specify properties that affect the number
of input or output ports as Nontunable . |
DiscreteState | Use DiscreteState to mark a property so it will
display its state value when you use the getDiscreteState method. |
Version History
Introduced in R2011b
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)