Inputs /
Outputs
Inputs, outputs, and related methods, such as Validate inputs and Disallow input
size changes.
When you select an input or output, the MATLAB Editor inserts the specified code in
the stepImpl method. In this example, selecting Insert > Input causes the MATLAB
Editor to insert the required input variable u2. The MATLAB Editor determines the
variable name, but you can change it after it is inserted.
function y = stepImpl(obj,u,u2)
% Implement algorithm. Calculate y as a function of
% input u and discrete states.
y = u;
end
Create a Temperature Enumeration
(^1) Open a new or existing System object.
(^2) In the MATLAB Editor, select Insert Property > Enumeration.
(^3) In the Enumeration dialog box, enter:
a Property Name with TemperatureUnit.
b Enumeration Name with TemperatureUnitValues.
(^4) Select the Create new enumeration check box.
(^5) Remove the existing enumeration values with the - (minus) button.
(^6) Add three an enumeration values with the + (plus) button and the following values:
- Fahrenheit
- Celsius
- Kelvin
(^7) Select Fahrenheit as the default value by clicking Default.
The dialog box now looks as shown:
Insert System Object Code Using MATLAB Editor