Main Content

Programmatically Generate I/O Dependency Matrix

This example shows how to programmatically generate a dependency matrix that shows the relationship between root level inports and outports.

To create the dependency matrix:

1. Open model slcheckSliceCruiseControl.

model='slcheckSliceCruiseControl';
open_system(model);

2. Create a SysDependencyTabulator object.

obj=SysDependencyTabulator(model);

3. Initialise a model handle.

sysH = get_param(model, 'handle');

4. Use tabulateDependencies method to create a dependency matrix for the model handle.

T1 = obj.tabulateDependencies(sysH)
T1=5×11 table
                      enbl    cncl    set    resume    inc    dec    brakeP    key    gear    throtDrv    vehSp
                      ____    ____    ___    ______    ___    ___    ______    ___    ____    ________    _____

    reqDrv             1       1       1       1        1      1       0        0      0         0          0  
    status             1       1       1       1        1      1       1        1      1         0          1  
    operation_mode     1       1       1       1        1      1       1        1      1         0          1  
    targetSp           1       1       1       1        1      1       1        1      1         0          1  
    throtCC            1       1       1       1        1      1       1        1      1         1          1  

5. Initialise a subsystem handle.

subsystemPath = [model '/CruiseControlMode'];
sysH = get_param(subsystemPath, 'handle');

6. Use tabulateDependencies method to create a dependency matrix for the subsystem handle.

T2 = obj.tabulateDependencies(sysH)
T2=2×5 table
              reqDrv    brakeP    vehSp    key    gear
              ______    ______    _____    ___    ____

    status      1         1         1       1      1  
    mode        1         1         1       1      1  

7. Delete the SysDependencyTabulator object.

delete(obj);

8. Close the model.

close_system(model);