主要内容

add

Add function to function group

Since R2026a

    Description

    add(functionGroupObj,functionObj) adds specified function functionObj to specified function group functionGroupObj.

    example

    Examples

    collapse all

    Create a model named mySoftwareArchitecture and get the root architecture.

    model = systemcomposer.createModel("mySoftwareArchitecture","SoftwareArchitecture");
    rootArch = model.Architecture;

    Create a software component and three functions.

    newComp = rootArch.addComponent("Component1");
    newFunctions = newComp.Architecture.addFunction({'Function1','Function2','Function3'});
    rootArch

    Set the period of three functions.

    fun1 = newFunctions(1);
    fun1.Period = 0.05;
    fun2 = newFunctions(2);
    fun2.Period = 0.05;
    fun3 = newFunctions(3);
    fun3.Period = 0.2;

    Create a function group named newFunctionGroup.

    functionGroup = rootArch.createFunctionGroup("newFunctionGroup", [fun1, fun2])

    Create a function and add it to function group named newFunctionGroup.

    fun4 = newComp.Architecture.addFunction('Function4');
    fun4.Period = 0.05;
    functionGroup.add(fun4);

    View component functions of function group.

    {functionGroup.ComponentFunctions.Name}

    Input Arguments

    collapse all

    Function group, specified as a systemcomposer.arch.Function object.

    Function, specified as a systemcomposer.arch.Function object.

    More About

    collapse all

    Version History

    Introduced in R2026a