importdata - Comma delimeter not working?
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2014-4-9
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!