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

4 views (last 30 days)
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 !

Accepted Answer

madhan ravi
madhan ravi on 13 Jun 2020
Edited: madhan ravi on 13 Jun 2020
c = {'21.15 (cd)';...
'42.12 (cd)';...
'24.45 (cd)'};
func = @(x) sscanf(c{x},'%f');
Wanted = arrayfun(func,1:numel(c)).'
  1 Comment
Cristian Martin
Cristian Martin on 13 Jun 2020
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

Sign in to comment.

More Answers (0)

Categories

Find more on Text Data Preparation in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!