How to read a *.csv file where the numbers are in quotes ("1","2", ...)?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jay Muller
le 27 Juil 2015
Modifié(e) : Jay Muller
le 28 Juil 2015
Hi,
I have a csv file where the numbers are in quotes (for whatever reason..):
"2.40000","0.16507","19.78564"
"2.50000","0.16671","20.64041"
"2.60000","0.16836","21.43273"
...
I'm desperately trying to read the numbers into a matrix, but all attempts (csvread, textscan, regexp, ...) failed. I'd therefore really appreciate any help on it. Thanks so much!
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 27 Juil 2015
[a,b,c]=xlsread(yourfile)
s=regexp(b,'[\d.]+','match')
out=str2double(cellfun(@(x) x{:},s,'un',0))
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Variables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!