sigrangeinfo

Retrieve signal range coverage information from cvdata object

Syntax

[min, max] = sigrangeinfo(cvdo, object)
[min, max] = sigrangeinfo(cvdo, object, portID)

Description

[min, max] = sigrangeinfo(cvdo, object) returns the minimum and maximum signal values output by the model component object within the cvdata object cvdo.

[min, max] = sigrangeinfo(cvdo, object, portID) returns the minimum and maximum signal values associated with the output port portID of the Simulink® block object.

Input Arguments

cvdo

cvdata object

object

An object in the model or Stateflow® chart that receives signal range coverage. Valid values for object include the following:

Object SpecificationDescription

BlockPath

Full path to a model or block

BlockHandle

Handle to a model or block

slObj

Handle to a Simulink API object

sfID

Stateflow ID

sfObj

Handle to a Stateflow API object

{BlockPath, sfID}

Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

{BlockPath, sfObj}

Cell array with the path to a Stateflow chart or atomic subchart and a Stateflow object API handle contained in that chart or subchart

{BlockHandle, sfID}

Cell array with a handle to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

portID

Output port of the block object

Output Arguments

max

Maximum signal value output by the model component object within the cvdata object, cvdo. If object outputs a vector, min and max are also vectors.

min

Minimum signal value output by the model component object within the cvdata object, cvdo. If object outputs a vector, min and max are also vectors.

Examples

collapse all

This example shows how to extract signal range info from a coverage data object.

Move the current MATLAB® directory to the location that contains the example files.

openExample('slcoverage/CollectSignalRangeDataForABlockExample');

Load the model and set up coverage options

Load the model into memory. This example uses a small controller model.

modelName = 'slvnvdemo_cv_small_controller';
load_system(modelName)

Declare coverage settings using a structure of parameter names and values. For a complete list of coverage parameters and their possible values, see Coverage Settings.

covOpts.CovEnable = 'on';
covOpts.CovSaveSingleToWorkspaceVar = 'on';
covOpts.CovSaveName = 'covData';
covOpts.CovMetricSignalRange = 'on';

Simulate the model using sim with the model name and the parameter structure as inputs.

simOut = sim(modelName,covOpts);

Get signal range data

Get the block handle of the Product block using get_param.

bHandle = get_param([modelName,'/Product'],'Handle');

Get the signal range data by calling sigrangeinfo with the cvdata object and the block handle as inputs.

[minVal, maxVal] = sigrangeinfo(covData,bHandle)
minVal =

     0


maxVal =

   25.0000

Alternatives

Use the coverage settings to collect signal range coverage for a model:

  1. Open the model for which you want to collect signal range coverage.

  2. In the Model Editor, select Model Settings on the Modeling tab.

  3. On the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis.

  4. Under Coverage metrics, select Signal Range.

  5. Click OK to close the Configuration Parameters dialog box and save your changes.

  6. Simulate the model by clicking the Run button and review the results.

Introduced in R2006b