Main Content

renameProfile

Rename profile in model

Since R2020b

    Description

    renameProfile(model,oldProfileName,newProfileName) renames a profile on a model from oldProfileName to newProfileName to make it consistent if the name of the profile was changed in the file explorer.

    Note

    Before you move, copy, or rename a profile to a different directory, you must close the profile in the Profile Editor or by using the close function. If you rename a profile, follow the example for the renameProfile function.

    example

    Examples

    collapse all

    Create a model.

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

    Create a profile with a stereotype and properties, open the Profile Editor, then apply the profile to the model.

    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 the model and close the model. Close the Profile Editor.

    save(model)
    close(model)

    Save the profile.

    save(profile)

    Rename the profile in the file explorer to LatencyProfileNew.xml.

    Load the model. Run the renameProfile API to update the model to refer to the correct renamed profile in the current directory.

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

    Input Arguments

    collapse all

    Architecture model, specified as a systemcomposer.arch.Model object.

    Old profile name, specified as a character vector or string.

    Example: "MyProfile"

    Data Types: char | string

    New profile name, specified as a character vector or string.

    Example: "MyProfileNew"

    Data Types: char | string

    More About

    collapse all

    Version History

    Introduced in R2020b