Main Content

sltest.observer.promoteObserver

Copy Observer Reference block to top level of model

Since R2024b

    Description

    obsref = sltest.observer.promoteObserver(path) copies the Observer Reference block, specified by its path located at path to the top level of the system model. The block retains all of its mappings and configuration settings. If an Observer Reference block is not at the top level of the system model, the Observer model does not observe the items mapped to the Observer Reference block when you simulate the system model.

    example

    Examples

    collapse all

    The promote_observer_ref model contains an Observer Reference block in the model_with_sf subsystem. This Observer Reference block is linked to the model_with_sf_Observer1 Observer model. Copy the Observer Reference block to the top level of the promote_observer_ref model.

    import sltest.observer.*
    open_system("promote_observer_ref");
    
    blockPath = Simulink.BlockPath({'promote_observer_ref/Model',...
       'model_with_sf/Observer'});
    obsref = promoteObserver(blockPath);
    

    Input Arguments

    collapse all

    Observer Reference block path of the block to copy to the top level of the system model, specified as a Simulink.BlockPath object.

    Output Arguments

    collapse all

    Observer Reference block, returned as a double data type block handle.

    Version History

    Introduced in R2024b