Problem reading the csv file with dlmread command.

Hi, We are trying to read the csv file,containing numerical values having 1095 rows with the header in 1st row.When we try to read the file in Matlab we get the error- R=dlmread('ff3all.csv'); "Error using dlmread (line 147) Mismatch between file and format character vector. Trouble reading 'Numeric' field from file (row number 1, field number 1) ==> date,Mkt-RF,SMB,HML,RF\n"
I've attached the file.Can you please help?

1 comentario

Stephen23
Stephen23 el 24 de Oct. de 2017
The file has a header. You need to specify that the range does not include the header.

Iniciar sesión para comentar.

Respuestas (1)

Stephen23
Stephen23 el 24 de Oct. de 2017
Editada: Stephen23 el 24 de Oct. de 2017
The file has a header. You need to specify that the range does not include the header:
>> M = dlmread('ff3all.csv',',',1,0)
M =
1.9261e+005 2.9600e+000 -2.3000e+000 -2.8700e+000 2.2000e-001
1.9261e+005 2.6400e+000 -1.4000e+000 4.1900e+000 2.5000e-001
1.9261e+005 3.6000e-001 -1.3200e+000 1.0000e-002 2.3000e-001
1.9261e+005 -3.2400e+000 4.0000e-002 5.1000e-001 3.2000e-001
1.9261e+005 2.5300e+000 -2.0000e-001 -3.5000e-001 3.1000e-001
1.9261e+005 2.6200e+000 -4.0000e-002 -2.0000e-002 2.8000e-001
1.9270e+005 -6.0000e-002 -5.6000e-001 4.8300e+000 2.5000e-001
1.9270e+005 4.1800e+000 -1.0000e-001 3.1700e+000 2.6000e-001
etc

Categorías

Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Oct. de 2017

Editada:

el 24 de Oct. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by