Extracing the part of the string from cell array

1 回表示 (過去 30 日間)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2018 年 6 月 25 日
コメント済み: Paolo 2018 年 6 月 25 日
I have a cell array a = {'abc__first__element' ; 'def__second__element'; ghi__third__element'}
I want to extract the string after first '__'
My final answer should be a = {'first__element'; 'second__element'; 'third__element'}
How can do this?
Thanks a lot

採用された回答

Paolo
Paolo 2018 年 6 月 25 日
regexp(a,'(?<=__)(.*)','match')
  2 件のコメント
Stephen23
Stephen23 2018 年 6 月 25 日
+1 nice and simple. To avoided nested cell arrays in the output use the 'once' option:
regexp(a,'(?<=__)(.*)','match','once')
Paolo
Paolo 2018 年 6 月 25 日
Good point! Would +1 your comment if that was a thing.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by