How do I get detectImportOptions to preserve row order and not skip rows?
Show older comments
I'm trying to read the attached textfile into a table so that I can call function row by row. I used the following import options ...
opt = detectImportOptions( ...
filepath, ...
'Filetype', 'text', ...
'VariableNamesLine', 1, ...
'Whitespace', ' ' ...
);
table = readtable(filepath, opt);
The output of readtable (attached, adfmap.mat) excludes some rows in the textfile and mixes up the ordering of the rows and I'm not sure why that is. I wrote a python script to check what was missing and the following rows containing these tokens were not imported:
"platform_vocabulary"
"sea_name"
"_NCProperties"
"creator_state"
"time_coverage_resolution"
"geospatial_vertical_max"
There are 110 lines (first line contains the 'Variable name" so 109 "data lines" total) but
table = readtable(filepath, opt);
returns 103 rows (again, with those 6 rows missing).
I created the textfile and used the following format:
- 3 fields ('variables') per line
- Comma as the delimiter
- Each field is double-quoted (comma and the single quote might be used as string characters)
Accepted Answer
More Answers (0)
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!