How do I get detectImportOptions to preserve row order and not skip rows?
Mostrar comentarios más antiguos
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)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Text Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!