Problem reading the csv file with dlmread command.
조회 수: 6 (최근 30일)
이전 댓글 표시
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
Stephen23
2017년 10월 24일
The file has a header. You need to specify that the range does not include the header.
답변 (1개)
Stephen23
2017년 10월 24일
편집: Stephen23
2017년 10월 24일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!