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 个评论

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
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 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by