importdata - Comma delimeter not working?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I'm trying to import data using the importdata function rather than xlsread (because of memory constratints --> importdata vs. xlsread).
My code reads as follows...
fid=dir('myfile.csv')
data=importdata(fid.name,',')
When I look at the data variable, it is a cell array, '<2252x1 cell>'.
The cell data{1} looks like this...
1,1,1,11481117,EXCITER GRO,11481117,C,,43,,,0,0,1,1,1,47,047XX,,ZCOM,,AEA,HALB
I would expect it to look like this, with every data point in its own column...
1 | 1 | 1 | 11481117 | EXCITER GRO | 11481117 | C | | 43 | | | 0 | 0 | 1 | 1 | 1 | 47 | 047XX | | ZCOM | | AEA | HALB
Am I missing something? Thanks!
-JF
2 Commenti
dpb
il 9 Apr 2014
Am I missing something?
Ayup :) That there's mixed data in the file so A can't be anything but a cell array from importdata. It supports mixed data only for the headers in returning a double for numeric fields.
Your option if can't read it with xlsread is to use textscan with a specific format for the various numeric/character fields.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Large Files and Big Data in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!