Main Content

remove

Delete unused line ranges

    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.

    Open the myAdd code file.

    file = "myAdd.m";
    open(file);

    Get the slreq.TextRange object associated with lines 1–3 in the myAdd function.

    cr = slreq.getTextRange(file,[1 3]);

    Get the links associated with the slreq.TextRange object.

    links = getLinks(cr)
    links=1×3 object
      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 3.

    remove(cr)

    Input Arguments

    collapse all

    Line range, specified as an slreq.TextRange object.

    Version History

    Introduced in R2022b