Create System Objects - MATLAB & Simulink (original) (raw)
Main Content
Write a MATLAB® class that creates and defines a new System object™
You can define your own System object by customizing the implementation methods. Use graphical tools to explore the comprehensive API for creating System objects. For example, you can insert methods to initialize, run, reset, and terminate System objects. For an introduction to defining a System object, see Define Basic System Objects.
Methods
Authoring Methods (Protected)
Input Specification
Output Specification
State Specification
Sample Time Specification
Interface Specification
Block Dialog and Appearance
Simulation Methods
Clone, Save, and Load
Help
Query Functions (Protected)
Functions for Implementing Authoring Methods
Implementation Methods (Public)
Methods for Implementing System Objects
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 |
delete | Delete System object |
output | Query current output of a System object |
update | Update state of a System object based on inputs |
supportsMultipleInstance | Check support for Simulink For Each subsystem for System object |
getDiscreteState | Get the discrete states of a System object |
getDiscreteStateSpecification | Get the size, data type, and complexity of the discrete state of a System object |
Methods for Querying Output Specification of System Objects
Functions
sysobjupdate | Update custom System object to latest syntax (Since R2020b) |
---|---|
get | Get states and properties of a System object |
set | Set values for properties of a System object |
Classes
Topics
Getting Started Writing System Objects
- Define Basic System Objects
Create a basic System object with thestepImpl
method.
Property Attributes
- Define Property Attributes
Specify property attributes to limit the type, visibility, and value of properties.
Input and Output
- Change the Number of Inputs
This example shows how to set the number of inputs for a System object™ with and without usinggetNumInputsImpl
. - Define Composite System Objects
Define System objects that include other System objects as properties. - Handle Input Specification Changes
Implement methods to restrict when System object input complexity, data type, or size can change or implement a method to react when input specifications change.
Performance and Efficiency
- Tips for Defining System Objects
Tips to speed up slow System objects. - Detailed Call Sequence
Call sequence showing the order of methods when you run a System object. - Define Finite Source Objects
This example shows how to define a System object that performs a specific number of steps or specific number of reads from a file. - Save and Load System Object
Use a MATLAB structure to save and load System object properties and state.