MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Insert System Object Code Using MATLAB Editor


In this section...
“Define System Objects with Code Insertion” on page 34-69
“Create a Temperature Enumeration” on page 34-73
“Create Custom Property for Freezing Point” on page 34-75
“Add Method to Validate Inputs” on page 34-76

Define System Objects with Code Insertion


You can define System objects from the MATLAB Editor using code insertion options.
When you select these options, the MATLAB Editor adds predefined properties, methods,
states, inputs, or outputs to your System object. Use these tools to create and modify
System objects faster, and to increase accuracy by reducing typing errors.

To access the System object editing options, create a new System object, or open an
existing one.

To add predefined code to your System object, select the code from the appropriate menu.
For example, when you click Insert Property > Numeric, the MATLAB Editor adds the
following code:

properties(Nontunable)
Property
end

The MATLAB Editor inserts the new property with the default name Property, which you
can rename. If you have an existing properties group with the Nontunable attribute, the
MATLAB Editor inserts the new property into that group. If you do not have a property
group, the MATLAB Editor creates one with the correct attribute.

Insert System Object Code Using MATLAB Editor
Free download pdf