uiimportdata and readtable do not recognize delimited columns

조회 수: 5 (최근 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 CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by