Extra variable when opening a file using readtable.
2 views (last 30 days)
Show older comments
Has anyone experienced the problem of getting an extra column of data at the very end of the datasset when using readtable() to open a file? For instance, if the file has 20 columns of data, then the output will have a 21st column named Var21 which is always NaNs. I'm not sure if it's a problem with the files that I'm reading or something else.
0 Comments
Accepted Answer
dpb
on 1 Dec 2017
Edited: dpb
on 1 Dec 2017
Even without seeing the files, with almost 100% certainty there's an extra delimiter at the end of the record which makes it look like an empty data field. If the record were
1,2,3,
4,5,6,
...
for instance, then to the input parser it is
value delim value delim value delim \n
so the sequence between the final delimiter and the newline (\n) is interpreted as missing data.
5 Comments
Peter Perkins
on 22 Dec 2017
At the moment, I believe it's just readtable.
Also I should correct myself: the function is named detectImportOptions.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!