isInputComplexityMutableImpl

Set whether System object input complexity can change

Syntax

mutable = isInputComplexityMutableImpl(obj,i)

Description

mutable = isInputComplexityMutableImpl(obj,i) returns whether the ith input to the object can change complexity when the object is in use.

This method is part of the matlab.System class.

Note

You must set Access = protected for this method.

Input Arguments

expand all

System object whose inputs are affected by this method.

This argument specifies which input to stepImpl is checked for complexity 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 complexity unless the StrictDefaults class attribute is set. If you implement this method, returning true means input complexity can change, and false means they cannot change.

Examples

Restrict Input Complexity Changes for Inputs

Restrict the complexity of all inputs by adding the isInputComplexityMutableImpl method and returning false. By adding this method, users of the System object cannot change the complexity of inputs while the System object is in use.

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

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

Restrict Input Complexity Changes for One Input

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

methods (Access = protected)
    function flag = isInputComplexityMutableImpl(obj,index)
        if index == 1
            flag = false;
        else
            flag = true;
        end
    end
end

Introduced in R2018a

Was this topic helpful?