importdata - Comma delimeter not working?

5 ビュー (過去 30 日間)
John
John 2014 年 4 月 9 日
コメント済み: dpb 2014 年 4 月 9 日
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 件のコメント
John
John 2014 年 4 月 9 日
Additionally, I'm exporting the file from Excel to the .csv format.
dpb
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 ExchangeLarge Files and Big Data についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by