Main Content

addStartingPoint

Class: SLSlicerAPI.SLSlicer
Namespace: SLSlicerAPI

Add block handles, block paths, bus elements, or Simulink Identifiers (SID) as starting point

Description

addStartingPoint(obj,StartingPoint) adds block(s), block path(s), or Simulink® Identifier (SID) as the StartingPoint to the model slice in obj for dependency analysis.

addStartingPoint(obj,PortHandle,busElementPath) adds a bus element as the starting point. Specify the port emitting the bus signal in PortHandle and the bus element path corresponding to the bus signal in busElementPath. You can add the starting point bus signal in the form of subsignal1.subsignal2 and so on. You can specify the subsignal up to any level. You should not specify the top level signal name corresponding to the bus.

Input Arguments

expand all

Model Slicer configuration, specified as an slslicer object containing Model Slicer configuration options.

Starting point for the model slice, specified as character vector, cell array, or bus. You can specify block name(s), block path(s), or Simulink Identifier (SID) as the starting point.

Name of the port emitting the bus signal, specified as cell array of character vectors or string array.

Path for the bus element from which you want to start the Model Slicer analysis is started, specified as cell array of character vectors or string array.

Examples

Starting Point at Block Handles

Specifies the block handle. To get the block handle, use the getSimulinkBlockHandle command.

1. Open the model.

open_system('sldvSliceClimateControlExample');

Add Model Slicer object.

obj = slslicer('sldvSliceClimateControlExample');
blkH = get_param('sldvSliceClimateControlExample/Out1','Handle');
addStartingPoint(obj,blkH);

2. To add multiple block handles as the starting point, use a cell array.

blkH = {get_param('sldvSliceClimateControlExample/Out1','Handle'),...
    get_param('sldvSliceClimateControlExample/Out2','Handle')};
addStartingPoint(obj,blkH);

Starting Point as Bus Element

Specify bus element limits as the starting point.

openExample('sldemo_mdlref_bus');
obj = slslicer('sldemo_mdlref_bus');
ph = get_param('sldemo_mdlref_bus/COUNTERBUSCreator1', 'PortHandles');
obj.addStartingPoint(ph.Outport, "limits");
obj.highlight;

Starting Point at Block Path

Specify the block path as a character vector.

bPath = {'sldvSliceClimateControlExample/Out1'};
addStartingPoint(obj, bPath);

To add multiple block paths as the starting point, use a cell array, for example.

bPath = {'sldvSliceClimateControlExample/Out1',...
'sldvSliceClimateControlExample/Heater/HeaterAct'};
addStartingPoint(obj, bPath);

Starting Point at SID

Specify Simulink Identifier, a unique designation assigned to a Simulink block or model annotation, as the starting point. To get the SID, use the Simulink.ID.getSID command.

addStartingPoint(obj, 'sldvSliceClimateControlExample:39')

Starting Point at LineHs

Specify handles of the lines connecting the Inport block to the Outport block. To get the Line Handle, use the get_param command.

 lh1 = get_param('sldvSliceClimateControlExample/Heater/Heat','LineHandles');
 lh2 = get_param('sldvSliceClimateControlExample/Heater','LineHandles');
 LineHs = [lh1.Inport(1), lh2.Outport(2)];
addStartingPoint(obj,LineHs);

Alternatives

To open the Model Slicer manager, in the Simulink Editor, on the Apps tab, click Model Slicer. To add a block or signal as the starting point, in the model, right-click the bus signal and select Model Slicer > Add as Starting Point.

To add bus element(s) as the starting point in the model, right-click the bus signal and select Model Slicer > Add Bus Elements as Starting Points. The Select Bus Element(s) window opens, where you can select the bus element(s) that you want to add as starting point(s) and click Add Starting Point.

Add Bus Elements as Starting Points

Figure showing the steps to add the bus elements as starting point.

Version History

Introduced in R2015b