Error with dlmread reading to many columns

1 回表示 (過去 30 日間)
James
James 2014 年 3 月 5 日
コメント済み: James 2014 年 4 月 7 日
I'm having a problem with dlmread where I'm specifying a range for it to read a csv file and it reads beyond that range.
My data looks like this: Date,Time,Intensity (mm/h),Precipitation since start (mm),Radar reflectivity (dBz),Number of detected particles,Temperature in sensor (°C),Spectrum 21.09.2012,14:34:00,0.000,0.00,-9.999,0,23,<SPECTRUM>ZERO</SPECTRUM>
My code looks like: rowcolrange = [1 2 1 6]; spdshtrange = 'C2..G2'; delimiter = ','; data = dlmread(filepathandname,delimiter,rowcolrange);
The error looks like this: ??? Error using ==> dlmread at 145 Mismatch between file and format string. Trouble reading number from file (row 1, field 8) ==> <SPEC
So it's trying to read the 8th field when I specify it not too. Why is this? Any help would be great!

採用された回答

Walter Roberson
Walter Roberson 2014 年 3 月 5 日
everything in the file must be numeric for you to be able to use dlmread, even if the non-numeric data is in a column you are not trying to read.
You should be using textscan()
  1 件のコメント
James
James 2014 年 4 月 7 日
Thanks, wasn't aware of that!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by