readtable bug - if file has only one line, then readtable throws error ONLY if ReadRowNames = 1

조회 수: 3 (최근 30일)
Consider a tab-delimited file with only a header line (no data otherwise)
e.g.
m.txt:
name<tab>age
Then
readtable('m.txt', 'FileType', 'text', 'Delimiter', '\t', 'ReadVariableNames', 1 , 'ReadRowNames', 0)
returns an empty table, like it is supposed to.
However
readtable('m.txt', 'FileType', 'text', 'Delimiter', '\t', 'ReadVariableNames', 1 , 'ReadRowNames', 1)
throws an error.

답변 (1개)

Peter Perkins
Peter Perkins 2015년 9월 21일
cmo, you are correct, thank you for finding this bug. I will make a note to have it fixed. For the time being, you can read in the file with ReadRowNames set to false, and then assign the row names and delete the string variable.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by