主要内容

set

设置 AUTOSAR 元素的属性

说明

set(arProps,elementPath,property,value)elementPath 处 AUTOSAR 元素的指定属性设置为 value。对于引用其他元素的属性,value 是路径。要设置 XML 打包选项,请将 elementPath 指定为 'XmlOptions'

示例

示例

全部折叠

对于 AUTOSAR 模型,将发送方-接收方接口 Interface1IsService 属性设置为 true,从而指示该端口接口用于 AUTOSAR 服务。

Model = 'autosar_swc_expfcns';
openExample(Model);
arProps = autosar.api.getAUTOSARProperties(Model);
set(arProps,'Interface1','IsService',true);
isService = get(arProps,'Interface1','IsService')
isService =
  logical
   1

对于 AUTOSAR 模型,将可运行实体 Runnable1symbol 属性设置为 'test_symbol'

Model = 'autosar_swc_expfcns';
openExample(Model);
arProps = autosar.api.getAUTOSARProperties(Model);
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'

输入参数

全部折叠

模型的 AUTOSAR 属性信息,以前由 arProps = autosar.api.getAUTOSARProperties(model) 返回,其中model 是一个表示模型名称的句柄、字符向量或字符串标量。

要为其设置属性的 AUTOSAR 元素的路径,指定为字符向量或字符串标量。要设置 XML 打包选项,请指定 'XmlOptions'

示例: 'Input'

要为其设置值的 AUTOSAR 元素属性,指定为字符向量或字符串标量。该属性必须为由 elementPath 指定的 AUTOSAR 元素的有效属性。

示例: 'IsService'

要为指定的属性设置的值。对于引用其他元素的属性,请指定路径。

版本历史记录

在 R2013b 中推出

全部展开