主要内容

本页采用了机器翻译。点击此处可查看英文原文。

hasStereotype

查找元素是否已应用构造型

自 R2021a 起

    说明

    如果构造型 stereotype 已应用到模型元素 element 上,则 result = hasStereotype(element,stereotype) 返回 true

    示例

    示例

    全部折叠

    创建一个带有组件的模型。

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");
    arch = get(model,"Architecture");
    comp = addComponent(arch,"Component");

    创建带有构造型和属性的配置文件,打开配置文件编辑器,然后将配置文件应用到模型。

    profile = systemcomposer.profile.Profile.createProfile("LatencyProfile");
    latencybase = profile.addStereotype("LatencyBase");
    latencybase.addProperty("latency",Type="double");
    latencybase.addProperty("dataRate",Type="double",DefaultValue="10");
    systemcomposer.profile.editor(profile)
    model.applyProfile("LatencyProfile");

    将构造型应用于组件。查找组件上是否应用了构造型。

    comp.applyStereotype("LatencyProfile.LatencyBase");
    result = hasStereotype(comp,"LatencyProfile.LatencyBase")
    result =
    
      logical
    
       1

    输入参数

    全部折叠

    构造型,指定为 "<profile>.<stereotype>"systemcomposer.profile.Stereotype 对象形式的字符向量或字符串。

    数据类型: char | string

    输出参量

    全部折叠

    查询结果,以 1 (true) 或 0 (false) 的形式返回。

    数据类型: logical

    详细信息

    全部折叠

    版本历史记录

    在 R2021a 中推出