Clear Filters
Clear Filters

Mismatch between file and format character vector.

7 views (last 30 days)
why I get this error:
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 2, field number 1) ==>
,0.009381993674,0.0067125028,0.007985085249,0.003736027749,0.009879481979,0.004188054241,0.004999999888\n

Answers (1)

Walter Roberson
Walter Roberson on 17 Feb 2021
The implication of the message is that you asked to skip the first row of the file and it did that, and then that the first thing it found in the second row was a comma when it expected a number.
If you always want to skip the first field of each row then where you used 1,0 in the call, use 1,1 . The first number is the number of rows to skip, and the second number is the number of columns to skip on each row.
If some of your lines start with commas and others do not, but you want to read the numbers if they are present, then use readtable() or readmatrix() or textscan() instead of dlmread(). dlmread() is implemented as a call to textscan() but does not support the options you need to deal with missing data.

Community Treasure Hunt

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

Start Hunting!