Mismatch between file and format character vector.
9 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Walter Roberson
2021-2-17
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!