how can I delete from a string a couple of lines I have indexed
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
flashpode
am 8 Nov. 2021
Bearbeitet: Cris LaPierre
am 8 Nov. 2021
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 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 8 Nov. 2021
Bearbeitet: Cris LaPierre
am 8 Nov. 2021
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 Kommentare
Weitere Antworten (1)
Kevin Holly
am 8 Nov. 2021
Are you looking for something like this?
str = ["line 1";"line 2";"line 3";"line 4";"line 5"]
var = [2 3];
str(var)=[]
0 Kommentare
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!