how can I delete from a string a couple of lines I have indexed
조회 수: 14 (최근 30일)
이전 댓글 표시
Hi so I've got a string and I've got a variable that contains the position of different messages from the string. How could I delete the lines I got in the variable?
댓글 수: 0
채택된 답변
Cris LaPierre
2021년 11월 8일
편집: Cris LaPierre
2021년 11월 8일
If it is a string array, and you want to remove a portion of a string in the array consider using eraseBetween:
If you have an array where each row contains a string, and you just want to remove entire rows, use indexing to set those rows equal to [].
myStr(rmvPositions) = [];
댓글 수: 0
추가 답변 (1개)
Kevin Holly
2021년 11월 8일
Are you looking for something like this?
str = ["line 1";"line 2";"line 3";"line 4";"line 5"]
var = [2 3];
str(var)=[]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!