error detection when reading in text
显示 更早的评论
I have a long file of which this is a typical sample
11-Aug-2015 102.3
12-Aug-2015 103.4
14-Aug-2015 101.7
15-Aug-2015 102.1
21-Aug-2015 102.8
23-Aug-2015 102.6
What is the easiest way to read in data like this, with error detection. Suppose for example (as happened to me recently) the fullstop in the middle of one of the numbers is mistakenly replaced by a comma. Or there could be some other obvious error in the format of the data file. I would like the script to tell me at least the line number on which the error occurs. Here are the relevant lines from the script that I would like to improve, in particular replacing textread by something else, since textread is now deprecated:
[cellfiledate,fileweight]=textread('DataFile','%s %f');
dnumsFile=datenum(cellfiledate,'dd-mmm-yyyy');
Should I use textscan? Thanks for any help.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!