How to delete specific text from multiple cell in a column ?

2 次查看(过去 30 天)
Hi!
I have the following column :
21.15 (cd)
42.12 (cd)
24.45 (cd)
..............
It must show like this, without brackets and text :
21.15
42.12
24.45
..............
Thanks in advance guys !

采纳的回答

madhan ravi
madhan ravi 2020-6-13
编辑:madhan ravi 2020-6-13
c = {'21.15 (cd)';...
'42.12 (cd)';...
'24.45 (cd)'};
func = @(x) sscanf(c{x},'%f');
Wanted = arrayfun(func,1:numel(c)).'
  1 个评论
Cristian Martin
Cristian Martin 2020-6-13
Hi Ravi, for my matrix I will have allways each time a different string of numbers, only text in brackets will be the same, so I need something that will scan and erase only text...Thanks

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by