Main Content

find

Find AUTOSAR elements

Description

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

example

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.

Examples

collapse all

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

addpath(fullfile(matlabroot,'/examples/autosarblockset/main'));
hModel = 'autosar_swc_expfcns';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
ifPaths = find(arProps,[],'SenderReceiverInterface',...
  'IsService',false,'PathType','FullyQualified')
ifPaths =
  1×2 cell array
    {'/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.

addpath(fullfile(matlabroot,'/help/toolbox/autosar/examples'));
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 =
  1×3 cell array
    {'/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.

Example: 'IsService',true

Output Arguments

collapse all

Variable that returns paths to AUTOSAR elements.

Example: ifPaths

Introduced in R2013b