Hauptinhalt

createTextRange

Class: slreq.LinkSet
Namespace: slreq

Create line ranges

Since R2022b

Description

cr = createTextRange(myLinkSet,lines) creates a line range associated with the lines of code, lines, in the MATLAB® or external code file associated with the link set specified by myLinkSet.

example

cr = createTextRange(myLinkSet,blockSID,lines) creates a line range in the MATLAB Function block specified by blockSID.

example

Input Arguments

expand all

Link set, specified as an slreq.LinkSet object.

Start and end line numbers for the line range, specified as a double array of the form [start end] or a scalar double.

Example: [1 4], 1

MATLAB Function block SID, specified as a string scalar or character vector.

Example: "30"

Output Arguments

expand all

Line range, returned as an slreq.TextRange object.

Examples

expand all

This example shows how to create an slreq.TextRange object for a link set.

Load the myAddRequirements requirement set.

rs = slreq.load("myAddRequirements");

Get a handle to the myAdd link set.

myLinkSet = slreq.find(Type="LinkSet",Description="myAdd2");

Create an slreq.TextRange object that corresponds to line numbers 2 in the myAdd function.

cr = createTextRange(myLinkSet,2);

Tips

Version History

Introduced in R2022b