Readtable() confused by quotation marks? Matlab 2019a
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello.
When executing
t = readtable('myfile.txt','FileType','text','Delimiter','|');
I am receiving this error
Error using readtable (line 216)
Reading failed at line 52223. All lines of a text
file must have the same number of delimiters. Line
52223 has 5 delimiters, while preceding lines have 9.
Note: readtable detected the following parameters:
'HeaderLines', 0, 'ReadVariableNames', false,
'Format', '%f%q%f%f%f%q%q%f%f%f'
I confirmed that the error is thrown, not because of the delimiters but because of a quotation mark. I confirmed this by removing the quotation marks from the file. Is there a way around this without altering the file itself?
Thank You,
Michael
채택된 답변
Jeremy Hughes
2019년 8월 26일
opts = detectImportOptions('myfile.txt','FileType','text','Delimiter','|')
T = readtable('myfile.txt',opts)
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!