Main Content

isInputDataTypeMutableImpl

Class: matlab.System

Set whether System object input data type can change

Syntax

mutable = isInputDataTypeMutableImpl(obj,index)

Description

mutable = isInputDataTypeMutableImpl(obj,index) returns whether the indexth input to the object can change data type when the object is in use.

Method Authoring Tips

You must set Access = protected for this method.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your isInputDataTypeMutableImpl method does not use the object, you can replace this input with ~.

This argument specifies which input to stepImpl is checked for data type mutability. The index number is the ordinal position of the input in the stepImpl signature.

Output Arguments

expand all

If you do not implement this method, inputs can change data type unless the StrictDefaults class attribute is set. If you implement this method, returning true means that input data type can change, and false means they cannot change.

Examples

expand all

Restrict changes to the data type of all inputs by adding the isInputDataTypeMutableImpl method and returning false. By adding this method, users of the System object cannot change the data type of inputs while the System object is in use.

function flag = isInputDataTypeMutableImpl(obj,~)
    flag = false;
end

To avoid a warning about unused variables, this example uses ~ as the second input argument. For more information about using ~ in place of arguments, see Using ~ as an Input Argument in Method Definitions.

This example shows how to write the isInputDataTypeMutableImpl method to only restrict one input. isInputDataTypeMutableImpl returns true for all inputs except input one.

methods (Access = protected)
    function flag = isInputDataTypeMutableImpl(obj,index)
        flag = (index ~= 1)
    end
end

Version History

Introduced in R2018a