Main Content

Simulink.getOutportInheritsInitialValue

Determine if conditional subsystem Outport block inherits initial output value

Since R2021a

    Description

    tf = Simulink.getOutportInheritsInitialValue(outblock) evaluates whether outblock is a conditional subsystem Outport block that inherits its initial output value from an input signal connected to the conditional subsystem. If so, it returns true. If not, it returns false. The return value is true under the same circumstances as the IC badge is displayed next to the Outport block on the Simulink® canvas, as described in Conditional Subsystem Initial Output Values.

    For the return value to be accurate, update or run the model before calling this function.

    The value returned by this function is meaningful only if the model is using simplified initialization mode. See Simplified Initialization Mode. If the model is using classic initialization mode, the return value is always false.

    example

    Examples

    collapse all

    The model my_model contains the enabled subsystem EnabledSub1, which contains Outport blocks Out1 and Out2.

    set_param('my_model/EnabledSub1/Out1','InitialOutput','0')
    set_param('my_model','SimulationCommand','Update')
    inherits = Simulink.getOutportInheritsinitialValue(...
                                     'my_model/EnabledSub1/Out1')
    inherits =
    
      logical
    
       0
    set_param('my_model/EnabledSub1/Out2','InitialOutput','[]')
    set_param('my_model','SimulationCommand','Update')
    inherits = Simulink.getOutportInheritsinitialValue(...
                                         'my_model/EnabledSub1/Out2')
    inherits =
    
      logical
    
       1
    inherits = Simulink.getOutportInheritsinitialValue(...
                  {'my_model/EnabledSub1/Out1' 'my_model/EnabledSub1/Out2'})
    inherits =
    
      2×1 logical array
    
       0
       1

    Input Arguments

    collapse all

    Identifier of conditional subsystem Outport block, specified as a character vector, string scalar, or numeric handle. Multiple block identifiers may be specified as a vector or a 1-dimensional cell array.

    Example: 'my_model/EnabledSub1/Out1'

    Data Types: character vector | string scalar | handle | vector | cell array

    Output Arguments

    collapse all

    Whether block inherits its initial output value, returned as a logical true or false. If the input value refers to an Outport block connected to a conditional subsystem and the block inherits its initial output value from that subsystem's input signal, tf is true. Otherwise, tf is false. If the input value is a vector or a cell array, tf is a logical column vector.

    For the return value to be accurate, update or run the model before calling this function.

    Data Types: logical | logical vector

    Version History

    Introduced in R2021a