SLSlicerAPI.SLSlicer class

Package: SLSlicerAPI

Class representing a set of Model Slicer functionality


The SLSlicerAPI.SLSlicer class provides set of methods to access Model Slicer functionality from the MATLAB command line. Use an instance of SLSlicerAPI.SLSlicer class to:

  • Activate or terminate slice simulation.

  • Add or remove starting point, exclusion point, constraints, slice component and configuration.

  • Highlight the functional dependencies.

  • Set time window and simulate slice.

  • Refine slice for dead logic analysis.


slslicer(model) creates an API object for the model model by exposing the methods for invoking Model Slicer. Uses the Model Slicer configurations associated with model, as defined by slsliceroptions.

slslicer(model, opts) creates an API object model model by using the options object opts, as defined by slsliceroptions.

Input Arguments

expand all

Name of the model whose Model Slicer options object you configure. slslicer uses the Model Slicer configurations associated with the model, as defined by slsliceroptions.

Example: sldvSliceClimateControlExample

Data Types: char | string

Structure containing the options for the Model Slicer configuration. slsliceroptions defines the options object opts.

Example: slsliceroptions

Data Types: struct


ActiveBlocksReturns the active non-virtual block handles
activateActivates the model for analysis
addExclusionPointAdds block handles, block paths, or Simulink Identifiers (SID) as slice exclusion point
addStartingPointAdd block handles, block paths, or Simulink Identifiers (SID) as the slice starting point
highlightUpdates the model highlighting
removeExclusionPointRemoves the exclusion point from the model slice
removeStartingPointRemoves the starting point from the model slice
simulate(t1,t2)Simulates a test case for dynamic slicing from time "t1" to time "t2"
terminateDiscards the analysis data and reverts the model highlighting (invoked when the object goes out of scope)
unhighlightRemoves the model highlighting without changing the activation status
unlockDiscards the analysis data while retaining model highlights

Additional Methods




Creates a sliced model from the model highlight.

Example: slice(obj,'sldvSliceClimateControlExample_sliced')


Adds the constraint on these blocks:

  • Switch or Multiport switch

  • Stateflow® state or transition

Example: bpath={'sldvSliceClimateControlExample/Refrigeration/On'};

addConstraint(obj,bpath,{1, 1})


Removes the constraint from the model slice.

Example: removeConstraint(obj,bpath)


Adds a model or a subsystem as a slice component.

Example: addSliceComponent(obj,'sldvdemo_cruise_control/Controller/PI Controller')


Removes the slice component from the model slice.

Example: removeSliceComponent(obj);


Updates the model highlighting with dead logic refinement.

Example: analysis_time=100;



Removes the dead logic refinement.

Example: removeDeadLogic(obj,'sldvSlicerdemo_dead_logic')

Object Functions

slslicerCreate API object for invoking Model Slicer


collapse all

Add a new starting point to the active Model Slicer configuration, and then highlight the model.

Open the sldvSliceClimateControlExample example model.


Create a Model Slicer configuration object for the model by using slslicer.

obj = slslicer('sldvSliceClimateControlExample');

To compile the model and prepare the model slice for dependency analysis, activate the slice highlighting mode of Model Slicer.


Add the Out1 outport block as the starting point and highlight the model slice.


The area of the model upstream of the starting point and which is active during simulation is highlighted.

Terminate the model highlighting mode and discard the analysis data.


Introduced in R2015b