Delete unused line ranges
remove( deletes the unused line range
You cannot delete a code range object that has links. Use the
deleteLinks function to delete links.
Remove Line Ranges
This example shows how to remove an
myAdd code file.
file = "myAdd.m"; open(file);
slreq.TextRange object associated with lines 1–3 in the
cr = slreq.getTextRange(file,[1 3]);
Get the links associated with the
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
count = deleteLinks(cr)
count = 3
slreq.TextRange object associated with line number 3.
Introduced in R2022b