Readtable() confused by quotation marks? Matlab 2019a

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

1 件のコメント

xi
xi 2019 年 8 月 26 日
Could you attatch the text file?

サインインしてコメントする。

 採用された回答

Jeremy Hughes
Jeremy Hughes 2019 年 8 月 26 日

0 投票

opts = detectImportOptions('myfile.txt','FileType','text','Delimiter','|')
T = readtable('myfile.txt',opts)

その他の回答 (1 件)

Michael
Michael 2019 年 8 月 26 日

0 投票

That worked. Thanks.

製品

質問済み:

2019 年 8 月 26 日

回答済み:

2019 年 8 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by