Why READTABLE skips the first line ?
6 次查看(过去 30 天)
显示 更早的评论
I have this Excel file (it's just a simplified detail) with different variables (only numeric or text, with nan values). Each line correspond to a patient.
If I use readtable, MATLAB skips the first line without warning.
I can use readcell instead but i want to understand why MATLAB makes this choice.
If I move the first line elsewhere, everything is OK.
Any explanation ?
Thank you in advance.
SAINTHILLIER Jean Marie
data = readtable('Test_pb.xlsx')
0 个评论
回答(2 个)
Mohammad Sami
2025-4-29
You can modify the behaviour of read table function by optional arguments. What you want to do it specify the Number of header lines to skip at the beginning of the file, specified as NumHeaderLines and either 0 or a positive integer. If unspecified, readtable automatically detects the number of lines to skip.
Stephen23
2025-4-29
编辑:Stephen23
2025-4-29
"Why READTABLE skips the first line ?"
Possibly because all of the text are shared strings, which perhaps confuses the READTABLE heuristics.
In any case, you do not need to use READCELL:
data = readtable('Test_pb.xlsx', 'DataRange','A2', 'VariableNamesRange','A1')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!