How to extract the string left and right to the matching alphabet

1 visualización (últimos 30 días)
Hi,
I have below cell array:
{'VA00K100E4TOO';'ZVA00K100E4TOO';'VZA00K100E6TO';'VB00K100E4TOO';'VP00K50E4T4O';'ZVG00K100E4TOO';'VF00K40E4T5O'}
I want to extract left and right side numerical of "E"
Desired Output:
100E4
100E4
100E6
100E4
50E4
100E4
40E4

Respuesta aceptada

David Fletcher
David Fletcher el 5 de Abr. de 2018
strs={'VA00K100E4TOO';'ZVA00K100E4TOO';'VZA00K100E6TO';'VB00K100E4TOO';'VP00K50E4T4O';'ZVG00K100E4TOO';'VF00K40E4T5O'}
result=regexp(strs,'\d+E\d+','match')
This returns a cell array of matching substrings
Assumes: the marker will always be an uppercase E. Returns one or more successive digits before the 'E' and one or more successive digits after the E

Más respuestas (0)

Categorías

Más información sobre Data Acquisition Toolbox Supported Hardware en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by