remove the number at the end of the string in cell array

35 ビュー (過去 30 日間)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015 年 11 月 10 日
編集済み: Stephen 2015 年 11 月 10 日
I have a cell array a = { 'Gain' ; 'Gain1' ; 'Delay' ; 'Delay1'}
I need to remove the number at the end of the string. How can i do this?
answer should be a = { 'Gain' ; 'Gain' ; 'Delay' ; 'Delay'} ;
Thanks a lot

採用された回答

Stephen
Stephen 2015 年 11 月 10 日
編集済み: Stephen 2015 年 11 月 10 日
You can use regexprep for this:
>> a = { 'Gain' ; 'Gain1' ; 'Delay' ; 'Delay1'};
>> b = regexprep(a,'\d+$','')
>> b{:}
ans = Gain
ans = Gain
ans = Delay
ans = Delay

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by