Main Content

set

Set property of AUTOSAR element

Description

example

set(arProps,elementPath,property,value) sets the specified property of the AUTOSAR element at elementPath to value. For properties that reference other elements, value is a path. To set XML packaging options, specify elementPath as XmlOptions.

Examples

collapse all

For an AUTOSAR model, set the IsService property for sender-receiver interface Interface1 to true (1), indicating that the port interface is used for AUTOSAR services.

addpath(fullfile(matlabroot,'/examples/autosarblockset/main'));
hModel = 'autosar_swc_expfcns';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
set(arProps,'Interface1','IsService',true);
isService = get(arProps,'Interface1','IsService')
isService =
  logical
   1

For an AUTOSAR model, set the symbol property for runnable Runnable1 to test_symbol.

addpath(fullfile(matlabroot,'/examples/autosarblockset/main'));
hModel = 'autosar_swc_expfcns';
open_system(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
compQName = get(arProps,'XmlOptions','ComponentQualifiedName');
runnables = find(arProps,compQName,'Runnable','PathType','FullyQualified');
runnables(2)
ans =
  1×1 cell array
    {'/pkg/swc/ASWC/IB/Runnable1'}
get(arProps,runnables{2},'symbol')
ans =
    'Runnable1'
set(arProps,runnables{2},'symbol','test_symbol')
get(arProps,runnables{2},'symbol')
ans =
    'test_symbol'

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 an AUTOSAR element for which to set a property. To set XML packaging options, specify XmlOptions,

Example: 'Input'

Property for which to set a value, among valid properties of the AUTOSAR element.

Example: 'IsService'

Value to set for the specified property. For properties that reference other elements, specify a path.

Example: true

Introduced in R2013b