uiimportdata and readtable do not recognize delimited columns

2 ビュー (過去 30 日間)
Glenn
Glenn 2015 年 6 月 22 日
回答済み: Gitesh Nandre 2015 年 6 月 23 日
I have been using a data reduction routine which loaded the data using "readtable" and discarded header lines. A change in the program to record the data has changed the format of the output so that the file is now comma separated rather than tab delimited and now there are fewer header lines. I have adjusted my code to use the correct delimiter and number of header lines, but receive the following error when I attempt to load the file:
"The data in this file does not appear to be tabular, with the same number of fields in each row and in each column. You might need to specify or modify the delimiter or number of header lines."
I tried to look at the data file using "uiimportdata" but I'm only able to see the first few header lines, and only 2 columns when I select the delimited option. If "fixed width" is selected, uiimportdata does display the other data, but the file is comma delimited, so that option is not useful. Loading the file in excel works fine.
Any ideas why these Matlab functions are not able to decipher the new delimited file? I can change some options in the program used to create the raw data file, but that has not helped so far either.

回答 (1 件)

Gitesh Nandre
Gitesh Nandre 2015 年 6 月 23 日
Let's say your file looks like this:
number,letter
88226,x
88226,y
88229,
If there is a space or newline after the comma at the end of the file, "readtable" will work. If not, you will get the error that you mentioned. This is a known issue with MATLAB. Check if that is the issue in your case.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by