Main Content

sltest.observer.addObserverPort

Add Observer Port block to model or subsystem

Since R2024b

    Description

    obsport = sltest.observer.addObserverPort(portlocation) adds an Observer Port block in the model or subsystem specified by portlocation. You typically place Observer Port blocks in Observer models.

    example

    Examples

    collapse all

    Open the sf_car model and add an Observer Reference block to the top level of the model. Adding an Observer Reference block to a model also creates a new Observer model. Then, add an Observer Port block to the Observer model. This example requires a Stateflow® license.

    import sltest.observer.*
    openExample("sf_car")
    mdl= get_param(gcs,"Handle");
    
    obsref = addObserverReference(mdl);
    obsmodel = get_param(gcs,"Handle");
    obsport = addObserverPort(obsmodel);
    

    To set the Observer Port block to observe an element in the system model, use the configureObserverPort function.

    Input Arguments

    collapse all

    Model or subsystem in which to place the Observer Port block, specified as a string, character vector, or double. Use a string or character vector to specify the location as a path, or use a double to specify the location as a handle.

    Output Arguments

    collapse all

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

    Version History

    Introduced in R2024b