readTable() interprets columns as numeric if first 250 entries are empty
古いコメントを表示
I am using readTable() to import a tab-delimited .txt file with many rows (~10,000) and several columns of non-numeric data. Some of the columns have many empty entries, which I have stored as empty quotes ("").
For most columns, readTable is able to import the data just fine. However, I noticed that some columns are interpreted as numeric, and therefore the entire column is imported as NaNs. I discovered that this happens for columns whose first ~250 rows are all empty, even the rest of their rows are not empty.
I know that I can explicitly specify that my format type is all strings, but it seems to me that the readTable function should be able to automatically detect this, especially when I'm using quotes for all entries in the .txt file (even the empty entries). Also, I need to use this function for .txt files that have both numeric and text columns, and I really don't want to hard-code the expected format type of every column...
1 件のコメント
Mehdi Ansarey
2024 年 12 月 16 日
Thanks, I had the same issue, when a column has sparse string, and matlab read its content as NaN.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!