Main Content

inlineComponent

Remove reference architecture or behavior from component

Description

componentObj = inlineComponent(component,inlineFlag) retains the contents of the architecture model referenced by the specified component and breaks the link to the reference model. If inlineFlag is set to 0 (false)., then the contents of the architecture model are removed and only interfaces remain. You can also use inlineComponent to remove Stateflow® chart and Simulink® behaviors from a component or to remove Simulink model or subsystem behaviors referenced by a component.

example

Examples

collapse all

Save the component robotComp in the architecture model Robot.slx and reference it from another component, electricComp, so that the electricComp component uses the architecture of the robotComp component. Remove the architecture reference from the robotComp component so that its architecture can be edited independently.

Create a model archModel.slx.

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

Add two components to the model electricComp and robotComp. Rearrange the model.

names = ["electricComp","robotComp"];
comp = addComponent(arch,names);
Simulink.BlockDiagram.arrangeSystem("archModel")

Save the robotComp component in the Robot.slx model so the component references the model.

saveAsModel(comp(2),"Robot");

Link the electricComp component to the same model Robot.slx so it uses the architecture of the original robotComp component and references the architecture model Robot.slx.

linkToModel(comp(1),"Robot");

Remove the architecture reference from the robotComp component while retaining the contents, so that its architecture can be edited independently, breaking the link to the referenced model.

inlineComponent(comp(2));

Clean up the model.

Simulink.BlockDiagram.arrangeSystem("archModel"); 

Add a Stateflow chart behavior to the component named robotComp within the current model. Then, remove the behavior.

Create a model archModel.slx.

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

Add two components to the model electricComp and robotComp. Rearrange the model.

names = ["electricComp","robotComp"];
comp = addComponent(arch,names);
Simulink.BlockDiagram.arrangeSystem("archModel")

Add Stateflow chart behavior model to the robotComp component.

createStateflowChartBehavior(comp(2));

Remove Stateflow chart behavior from the robotComp component and remove all contents of the Stateflow chart.

inlineComponent(comp(2),false);

Clean up the model.

Simulink.BlockDiagram.arrangeSystem("archModel"); 

Input Arguments

collapse all

Component linked to an architecture model, specified as a systemcomposer.arch.Component object.

Control of contents of component, specified as 1 (true) or 0 (false).1 (true) if contents of the referenced architecture model are copied to the component architecture and 0 (false). if the contents are not copied and only ports and interfaces are preserved.

Data Types: logical

Output Arguments

collapse all

Component with referenced architecture or behavior removed, returned as a systemcomposer.arch.Component object.

More About

collapse all

Version History

Introduced in R2019a