How to take part of the string
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mekala balaji
el 2 de Sept. de 2017
Respondida: Walter Roberson
el 2 de Sept. de 2017
Hi,
I have the following cell array.
STB.VD02K500E3T00
STB.VD06K13E3T20
VD02K150E3T00
Detail03
Dummay03
STB.VG02K500E5T00
STB.F02K500E0T00
PR_STB.F02K500E3T00
Now, I want to take the part of numerical just left&right side to the E including E if the name starts with STB., My desired output:
500E3
13E3
150E3
Detail03
Dummay03
500E5
500E0
PR_STB.F02K500E3T00
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Sept. de 2017
result = regexprep(YourCell, '^(STB|V).*?(\d+E\d+).*', '$2');
I used the rule from your "desired output", not the rule from your description: your desired output extracts the number from a string that starts with V but your description says only if it starts with STB. If the rule is to be STB only and the transformation of the V line was in error then
result = regexprep(YourCell, '^STB.*?(\d+E\d+).*', '$1')
0 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!