Main Content

add

Add property to AUTOSAR element

Description

example

add(arProps,parentPath,property,name) adds a composite child element with the specified name to the AUTOSAR element at parentPath, under the specified property.

add(arProps,parentPath,property,name,childproperty,value) sets the value of a specified property of the added child property element.

Examples

collapse all

Add data element DE3 to sender interface Interface1.

addpath(fullfile(matlabroot,'/examples/autosarblockset/main'));
hModel = 'autosar_swc_expfcns';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
add(arProps,'Interface1','DataElements','DE3');
get(arProps,'Interface1','DataElements')
ans =
  1×3 cell array
    {'Interface1/DE1'}    {'Interface1/DE2'}    {'Interface1/DE3'}

Using a fully qualified path, add a mode-switch interface and set the IsService property to true. Add mode group mgModes to the mode-switch interface using the composite property ModeGroup.

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'}
add(arProps,'/pkg/if/Interface3','ModeGroup','mgModes');
get(arProps,'Interface3','ModeGroup')
ans =
    'Interface3/mgModes'

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 to a parent AUTOSAR element to which to add a specified child property element.

Example: 'Input'

Type of property to add, among valid properties for the AUTOSAR element.

Example: 'DataElements'

Name of the child property element to add.

Example: 'DE1'

Child property to set, and its value. Table Properties of AUTOSAR Elements lists properties that are associated with AUTOSAR elements.

Example: 'Name','event1'

Introduced in R2013b