Importing issues with textscan

1 view (last 30 days)
Tim P.
Tim P. on 7 Nov 2016
Commented: Walter Roberson on 7 Nov 2016
I'm importing a .txt file, consisting of 4 columns (I'm only using 3) and over 400,000 rows, using textscan (script generated from the import tool). The initial import completes successfully however, there is an issue at around the same point during each import. At approximately row 168550 the importer seems to stumble and can't read the columns correctly, producing one seemingly random number and two NaN values - for the three columns. The following row returns to the correct data. I've double checked the raw data and it does have proper values. I've also noticed some inconsistencies between the raw data and a few of the values (for obvious reasons, I haven't checked them all).
Is there a better tool for importing the data? Can I slow down the import to prevent errors? Can it be checked - like a checksum?
Thanks in advance for any insight you can provide.
  1 Comment
Walter Roberson
Walter Roberson on 7 Nov 2016
Would it be possible to attach the file?
If you take a copy of the file and crop out the first 150000 or so lines, does the problem stay with the line or does it stay with the relative position 168550 ?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by