主要内容

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

renameProfile

重命名模型中的配置文件

    说明

    renameProfile(model,oldProfileName,newProfileName) 将模型上的配置文件从 oldProfileName 重命名为 newProfileName,以便在文件资源管理器中更改配置文件名称时保持一致。

    注意

    在将配置文件移动、复制或重命名到不同目录之前,必须先在配置文件编辑器中或使用 close 函数关闭该配置文件。如果要重命名配置文件,请参照 renameProfile 函数的示例。

    示例

    示例

    全部折叠

    创建一个模型。

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");

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

    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");

    保存模型并关闭模型。关闭配置文件编辑器

    save(model)
    close(model)

    保存配置文件。

    save(profile)

    将文件资源管理器中的配置文件重命名为 LatencyProfileNew.xml

    加载模型。运行 renameProfile API 更新模型,以引用当前目录中重命名后的正确配置文件。

    model = systemcomposer.loadModel("archModel");
    model.renameProfile("LatencyProfile","LatencyProfileNew");

    输入参数

    全部折叠

    架构模型,指定为 systemcomposer.arch.Model 对象。

    旧的配置文件名称,指定为字符向量或字符串。

    示例: "MyProfile"

    数据类型: char | string

    新的配置文件名称,指定为字符向量或字符串。

    示例: "MyProfileNew"

    数据类型: char | string

    详细信息

    全部折叠

    版本历史记录

    在 R2020b 中推出