Main Content

remove

Delete unused line ranges

Since R2022b

    Description

    example

    remove(lr) deletes the unused line range lr.

    Note

    You cannot delete a code range object that has links. Use the deleteLinks function to delete links.

    Examples

    collapse all

    This example shows how to remove an slreq.TextRange object.

    Load the links data associated with the myAdd code file and load the myAddRequirements requirement set.

    file = "myAdd.m";
    slreq.load(file);
    rs = slreq.load("myAddRequirements");

    Get the slreq.TextRange object associated with line 1 in the myAdd function.

    cr = slreq.getTextRange(file,1);

    Get the links associated with the slreq.TextRange object.

    links = getLinks(cr)
    links=1×3 Link array with properties:
        Type
        Description
        Keywords
        Rationale
        CreatedOn
        CreatedBy
        ModifiedOn
        ModifiedBy
        Revision
        SID
        Comments
    
    

    Delete the links associated with the slreq.TextRange object.

    count = deleteLinks(cr)
    count = 3
    

    Remove the slreq.TextRange object associated with line number 1.

    remove(cr)

    Input Arguments

    collapse all

    Line range, specified as an slreq.TextRange object.

    Version History

    Introduced in R2022b