Main Content

find

Find AUTOSAR elements

Description

paths = find(arProps,rootPath,category) returns paths to AUTOSAR elements matching category, starting at path rootPath.

paths = find(arProps,rootPath,category,'PathType',value) specifies whether the returned paths are fully qualified or partially qualified.

example

paths = find(arProps,rootPath,category,property,value) specifies a constraining value on a property of the specified category of elements, narrowing the search.

example

Examples

collapse all

For a model, find sender-receiver interfaces for which the property IsService is false and return fully qualified paths.

hModel = 'autosar_swc_expfcns';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
ifPaths = find(arProps,[],'SenderReceiverInterface',...
  'IsService',false,'PathType','FullyQualified')
ifPaths = 1x2 cell
    {'/pkg/if/Interface1'}    {'/pkg/if/Interface2'}

For a model, add a mode-switch interface and then use find to list paths for mode-switch interfaces in the model.

hModel = 'mAutosarMsConfigAfter';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
addPackageableElement(arProps,'ModeSwitchInterface','/pkg/if','Interface3',...
  'IsService',true);
ifPaths = find(arProps,[],'ModeSwitchInterface','PathType','FullyQualified')
ifPaths = 1x3 cell
    {'/pkg/if/myMsIf'}    {'/pkg/if/MsIf2'}    {'/pkg/if/Interface3'}

Input Arguments

collapse all

AUTOSAR properties information for a model, previously returned by arProps = autosar.api.getAUTOSARProperties(model). model is a handle, character vector, or string scalar representing the model name.

Example: arProps

Path specifying the starting point at which to look for the specified type of AUTOSAR elements. [] indicates the root of the component.

Example: []

Type of AUTOSAR element for which to return paths.

Example: 'SenderReceiverInterface'

Specify FullyQualified to return fully qualified paths.

Example: 'PathType','FullyQualified'

Valid property of the specified category of elements, and a value to match for that property in the search. Table Properties of AUTOSAR Elements lists properties that are associated with AUTOSAR elements, and for more information regarding the properties, see AUTOSAR Element Properties.

Example: 'IsService',true

Output Arguments

collapse all

Variable that returns paths to AUTOSAR elements.

Example: ifPaths

Version History

Introduced in R2013b