extract numbers from cell array
80 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
alex
il 10 Mag 2014
Commentato: Sebastian Lopez
il 19 Apr 2023
hello!
i have this cell array wich may have many cells,and not only three as here.
A = {'jdldi'; 'jdks5.4555h'; 'f67'}
i want to extract only the numbers,and show them as one number
for this example i want the result to be 5.455567
any help please?
Thank you very much!
Risposta accettata
Azzi Abdelmalek
il 10 Mag 2014
A = {'jdldi'; 'jdks5.4555h'; 'f67'}
b=regexp(A,'\d+(\.)?(\d+)?','match')
out=str2double([b{:}])
3 Commenti
Azzi Abdelmalek
il 10 Mag 2014
Modificato: Azzi Abdelmalek
il 10 Mag 2014
A = {'jdldi'; 'jdks5.4555h'; 'f67'}
b=regexp(A,'\d+(\.)?(\d+)?','match')
out=strjoin([b{:}],'')
Più risposte (2)
Andrei Bobrov
il 10 Mag 2014
A1 = regexp(A,'[\d*\.]*\d*','match')
A2 = [A1{:}]
out = str2double(strcat(A2{:}))
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!