uiimportdata and readtable do not recognize delimited columns
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Gitesh Nandre
on 23 Jun 2015
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.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!