error in tall array tables due to missing data in end column of end row

1 回表示 (過去 30 日間)
minomi
minomi 2018 年 2 月 23 日
コメント済み: minomi 2018 年 3 月 5 日
I have a csv file which looks something like this:
DATA_START
02/16/18 01:03:32.11,,4,
02/16/18 01:03:32.22,,4,
02/16/18 01:03:32.33,,5,
02/16/18 01:03:32.44,,5,
02/16/18 01:03:32.11,,0.4,
02/16/18 01:03:32.01,4,4,
02/16/18 01:03:32.02,,4,
02/16/18 01:03:32.03,,3,
02/16/18 01:03:32.04,7,0,
I have noticed that when I use data store and tall arrays (tt = tall(ds)), I get an error and tall array looks like:
tt =
M×4 tall table
date_time Var2 Var3 Var4
_________ ____ ____ ____
? ? ? ?
? ? ? ?
? ? ? ?
: : : :
: : : :
I have noticed that if I add a variable at the end row of the end column, this problem goes away, but as I am dealing with a lot of data files (some of which are too large to open) I need to be able to resolve this issue without having to manually change the file. Any idea how I can fix this?
  2 件のコメント
Benjamin Kraus
Benjamin Kraus 2018 年 2 月 23 日
What error do you get? What code are you using to load the CSV file to a datastore?
minomi
minomi 2018 年 2 月 23 日
I've created datastore using:
ds = datastore(data_file_location);
and tall array using:
tt = tall(ds)
the error is:
Warning: Error encountered during preview of tall array 'tt'. Attempting to gather 'tt' will probably result in an error. The error encountered was:
The data in file: 'C:\Users\foldername\test1.csv' does not
appear to be tabular, with the same number of fields in each row and in each column. Verify the Text Format and Advanced Text Format Properties.

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

回答 (1 件)

Edric Ellis
Edric Ellis 2018 年 2 月 26 日
It sounds like you haven't got the format quite right for your datastore. I suspect you would encounter the same error if you called readall on your datastore. To work with datastore, you need to ensure that all the files are in the same format.
There's lots of information about how to set up the datastore to read tabular text (such as .csv) in the documentation.
  6 件のコメント
minomi
minomi 2018 年 3 月 2 日
編集済み: minomi 2018 年 3 月 2 日
@Chandani Madnani I still get the same error . Can I ask if you get the same errors with this data file?
minomi
minomi 2018 年 3 月 5 日
I just copied and pasted the file into a new gedit document and that seemed to get rid of the error. Previously I was using Notepad. Any idea why this might be? How can I get rid of this problem without having to open the files?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by