readtable produces NaN values while reading a .txt file
5 views (last 30 days)
Show older comments
I am reading a text file using readtable:
opts = detectImportOptions('test.txt');
T = readtable('test.txt',opts);
The last line of the test.txt file is exactly as follows with a '%' sign at the beginning as follows:
%rate[1]:={0.0,46,87,47,807,842,42,.... up to 200 numbers}
But when I looked at T after reading the file, it says NaN for that particular variable:
{'%rate[1]:' } NaN
Is there a good way to tackle this?
4 Comments
Guillaume
on 26 Feb 2020
I should have said: attach a sample file that reproduces the problem. I don't get any NaN with your sample file.
Saying that, the format of the file doesn't appear suitable at all for readtable. You may be able to coerce readtable to read it correctly but it's not designed for this.
Answers (0)
See Also
Categories
Find more on Text Files 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!