Hello,
Like many others, I have csv file where the first rows (in my case 10 rows) containing text (or are empty), and hence I haven't find a way to figure how to import the file. I have tested other solutions, like (<http://www.mathworks.com/matlabcentral/answers/22710-help-removing-columns-from-csv-file)>, but that didn't solve the problem. When open the csv file in Excel, the beginning looks like this: (It looks very fuzzy, sorry for that).
Model,"WE7000" BlockNumber,"1" TraceName,"CH3","CH4", BlockSize,288154,288154, Date,08/11/25,08/11/25, Time,10:07:43,10:07:43, VUnit,V,V, HResolution,5.000000e-006,5.000000e-006,
block0 -4.999995E+000,-3.230750E+002,-3.685000E+001 -4.999990E+000,-3.230750E+002,-3.685000E+001 -4.999985E+000,3.104250E+002,-3.677500E+002 -4.999980E+000,3.104250E+002,-3.677500E+002 -4.999975E+000,-8.191750E+002,-8.189500E+002

 채택된 답변

Olle Schälin
Olle Schälin 2014년 8월 28일

0 개 추천

I have extracted the first 12 rows from the original file into a separate one, and attached that. I hope that will give a view how the the original file looks like.
Previous, I have been succesful with using dlmread with other kind of files (i.e dat), where the first rows have been pure text, i.e using this kind of command:
m=dlmread('Test_20130404_0006.dat','/',13,0); or m=dlmread('Test_20130404_0006.dat','',13,0);
But when I´m doing that with my original csv file I get a quite common error message:
Mismatch between file and format string. Trouble reading number from file (row 2u, field 1u) ==>

댓글 수: 3

Michael Haderlein
Michael Haderlein 2014년 8월 28일
Will there be more blocks or only this one? In other words, once the data rows have started, will there be text later on or will there only be data rows the entire file?
resp, you have set the wrong delimiter:
>> m=dlmread('Book2.csv',',',10,0)
m =
-5.0000 -323.0750 -36.8500
-5.0000 -323.0750 -36.8500
Olle Schälin
Olle Schälin 2014년 8월 28일
Damn, just too easy. I guess a need to change the resolution of my screen.
Many thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Michael Haderlein
Michael Haderlein 2014년 8월 28일

0 개 추천

Without line breaks, it's a bit tricky to see how the file is formatted. However, all the text file reading functions have kind of a headerlines functionality (range for dlmread). You can just skip the first 10 rows with that. If you need help to apply such headerlines, please attach a sample file. It makes things easier usually ;-)

카테고리

도움말 센터File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

태그

질문:

2014년 8월 28일

댓글:

2014년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by