Hi
I have a .csv file in the following format:
SimpleDB data file version 2.0
TIMESTAMP,mode_0[-],,state_0[-],,Run_0[h],,Feed_0[h],,gbkr_0[-],,bkrop_0[-],,Etot_0[kWh],,Eday_0[kWh],,Pac_0[kW],,Q_0[kVAr],,Iac_0[A],,Uac_0[V],,fac_0[Hz],,cphi_0[-],,Paclim_0[kW],,Qset_0[kVAr],,Pdc_0[kW],,Udc1_0[V],,Idc1_0[A],,Pdc1_0[kW],,Udc2_0[V],,Idc2_0[A],,Pdc2_0[kW],,Udc3_0[V],,Idc3_0[A],,Pdc3_0[kW],,Udc4_0[V],,Idc4_0[A],,Pdc4_0[kW],
1425254400002,???,AAG8/,0,AAG8/,NaN,AAG8/,NaN,AAG8/,false,AAG8/,0,AAG8/,NaN,AAG8/,0.000,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,10.000,AAG8/,0.000,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/
1425254401001,???,AAG8/,0,AAG8/......
It is a very big file, and as you can see contains a lot of NaN's and other strings. I have tried using csvread(), but it doesn't work. I get the
Mismatch between file and format string.
Trouble reading 'Numeric' field from file (row number 1, field number 2) ==>
???,AAG8/,0,AAG8/,NaN,AAG8/,NaN,AAG8/,false,AAG8/,0,AAG8/,NaN,AAG8/,0.000,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,10.000,AAG8/,0.000,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,AAG8/,NaN,A...
I have also tried xlsread(), and it kind of works, but only on a computer with excel installd, and I need it to work on any computer. Does anybody know how I can effectively read such a file, and sort the data under the right header collumns?
Regards Adam

답변 (1개)

Michael Haderlein
Michael Haderlein 2015년 3월 9일

0 개 추천

Reading should be possible with textscan. You can define the format of the data columnwise. Does it help?

카테고리

도움말 센터File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

질문:

2015년 3월 9일

답변:

2015년 3월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by