Main Content


Get cell array of model elements in critical path

Since R2024a



    criticalPathBlocks = coder.profile.test.getCriticalPathElements(resultsObject) returns a cell array of blocks that are in the critical path identified by coder.profile.test.analyzePath.


    collapse all

    Use coder.profile.test.getCriticalPathElements to get a cell array of blocks in the identified critical path.

    Open the CriticalPathIdentify model.

    model = "CriticalPathIdentify";

    Identify the critical path of the generated code by using the coder.profile.test.analyzePath function and store the results in myResults.

    myResults = coder.profile.test.analyzePath(model,SimMode="SIL")

    Get a list of the blocks in the identified path.

    criticalPathBlocks = coder.profile.test.getCriticalPathElements(myResults)

    criticalPathBlocks =
      24×1 cell array
        {'CriticalPathIdentify/If'                                   }
        {'CriticalPathIdentify/If Action1'                           }
        {'CriticalPathIdentify/If Action1/Action Port'               }
        {'CriticalPathIdentify/If Action1/For Iterator1'             }
        {'CriticalPathIdentify/If Action1/For Iterator1/For Iterator'}
        {'CriticalPathIdentify/If Action1/For Iterator1/Sum'         }
        {'CriticalPathIdentify/If Action1/For Iterator1/Unit Delay'  }
        {'CriticalPathIdentify/If Action1/In1'                       }
        {'CriticalPathIdentify/If Action1/Out1'                      }
        {'CriticalPathIdentify/If Action2'                           }
        {'CriticalPathIdentify/If Action2/Action Port'               }
        {'CriticalPathIdentify/If Action2/For Iterator2'             }
        {'CriticalPathIdentify/If Action2/For Iterator2/For Iterator'}
        {'CriticalPathIdentify/If Action2/For Iterator2/Sum'         }
        {'CriticalPathIdentify/If Action2/For Iterator2/Unit Delay'  }
        {'CriticalPathIdentify/If Action2/In1'                       }
        {'CriticalPathIdentify/If Action2/Out1'                      }
        {'CriticalPathIdentify/If1'                                  }
        {'CriticalPathIdentify/In1'                                  }
        {'CriticalPathIdentify/In2'                                  }
        {'CriticalPathIdentify/In4'                                  }
        {'CriticalPathIdentify/Merge'                                }
        {'CriticalPathIdentify/Merge1'                               }
        {'CriticalPathIdentify/Out1'                                  }

    Input Arguments

    collapse all

    Critical path analysis result, specified as a coder.profile.ExecutionTimeSet object. This object is returned by the coder.profile.test.analyzePath function

    Output Arguments

    collapse all

    Blocks in the critical path, specified as a cell array.

    Version History

    Introduced in R2024a