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

3 次查看(过去 30 天)
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

采纳的回答

David Fletcher
David Fletcher 2018-4-5
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by