Main Content


自定义适用于 Simulink 的 System object

自定义 System object™ 以便在 MATLAB System 模块中使用

MATLAB System 模块支持在 Simulink® 中将在 MATLAB® 中定义的 System object 作为模块使用。要控制模块的外观或输出,或者要允许在 For Each 子系统中使用 System object,请使用所提供的实现方法对您的 System object 进行自定义。有关定义 System object 的详细信息,请参阅定义基本 System objectSystem object



getIconImplName to display as block icon
getHeaderImplHeader for System object display
getInputNamesImplNames of MATLAB System block input ports
getOutputNamesImplNames of MATLAB System block output ports
getPropertyGroupsImplProperty groups for System object display
getSimulateUsingImplSpecify value for Simulate using parameter
showSimulateUsingImplVisibility of Simulate using parameter
showFiSettingsImplFixed point data type tab visibility for System objects
allowModelReferenceDiscreteSampleTimeInheritanceImplModel reference sample time inheritance status for discrete sample times
getGlobalNamesImplGlobal variable names for MATLAB System block
getDiscreteStateImplDiscrete state property values
getDiscreteStateSpecificationImplDiscrete state size, data type, and complexity
getOutputDataTypeImplData types of output ports
getOutputSizeImplSizes of output ports
getSimulinkFunctionNamesImplRegister Simulink function names used in your System object
isOutputComplexImplComplexity of output ports
isOutputFixedSizeImplFixed- or variable-size output ports
processTunedPropertiesImplAction when tunable properties change
propagatedInputComplexityComplexity of input during Simulink propagation
propagatedInputDataTypeData type of input during Simulink propagation
propagatedInputFixedSizeFixed-size status of input during Simulink propagation
propagatedInputSizeSize of input during Simulink propagation
isInputDirectFeedthroughImplDirect feedthrough status of input
outputImplOutput calculation from input or internal state of System object
updateImplUpdate object states based on inputs
createSampleTimeCreate sample time specification object
getSampleTimeImplSpecify sample time type, offset time, and sample time
getSampleTimeQuery sample time
getCurrentTimeCurrent simulation time in MATLAB System block
setNumTicksUntilNextHitSet the number of ticks in Simulink sample time
supportsMultipleInstanceImplSupport System object in Simulink For Each subsystem


matlab.system.display.IconCustom icon image
matlab.system.display.ActionCustom button
matlab.system.display.HeaderHeader for System objects properties
matlab.system.display.SectionProperty group section for System objects
matlab.system.display.SectionGroupSection group for System objects



Define System Object for Use in Simulink

Develop MATLAB System block and interactively preview block dialog box.

System Design in Simulink Using System Objects

Design systems in Simulink using System objects.


Customize System Block Appearance

Customize the MATLAB System block icon and the input and output names.

Customize System Block Dialog Box

Customize the MATLAB System block dialog box by adding tabs, groups, description, and more.


Set Model Reference Discrete Sample Time Inheritance

Disallow model reference discrete sample time inheritance for a System object.

Use Global Variables in System Objects

Define global variables for use in System objects.

Specify Output

If Simulink cannot infer the System object output characteristics, add methods to specify the size, data type, complexity, or discrete state output.


Use Update and Output for Nondirect Feedthrough

Implement nondirect feedthrough for a System object using the updateImpl, outputImpl, and isInputDirectFeedthroughImpl methods.

Enable For Each Subsystem Support

Enable For Each subsystem support by using a System object in a Simulink For Each subsystem.

Specify Sample Time for MATLAB System Block System Objects

This example shows how to control the sample time of the MATLAB System block using System object™ methods.