Remove simultaneously several substrings in a string
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sim
am 16 Dez. 2021
Kommentiert: Mathieu NOE
am 16 Dez. 2021
Hi, I have a string
A = "159 (51,1%) 13 (4,2%) 139 (44,7%)";
and I would need to remove all the numbers among brackets (and brackets included!). My goal is to get this new string:
A = "159 13 139";
Any idea ?
I tried this, but it is not working:
>> strtok(A,'()')
ans =
"159 "
0 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 16 Dez. 2021
hello
try this
A = "159 (51,1%) 13 (4,2%) 139 (44,7%)";
B = split(A,' ');
B(contains(B,'(')) = [];
B = join(B,' ');
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu String Parsing 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!