Cell array after cell2table command in MATLAB 2020a

1 view (last 30 days)
Hi guys,
I am dealing with a large dataset recently. I want to match data in a CTD csv file (20 columns) with the metadata (14 columns) in my image analysis by the conversion of Julian days. Then save the entire worksheet (34 columns) into a new csv file. However, some columns went blank when I saved the data. I checked back on the variable found something like this:
It looks like some cell arrays were not converted into the table, they remained as cell format by cell2table command. The size of the table was around 100,000 x 34. But the same code worked well with a smaller dataset. I was able to output the result in each column by a 20,000 x 34 dataset. I loaded the CTD file by readmatrix() and the metadata in image analysis by readtable() because there are some strings in the matadata. When merging the data to one table, I converted each data into cell first, then convert the entire 43 column cell into a table, finally save the table format worksheet into csv file. I have been trapped by this for days. I would really appreciate it if anyone could help me out.
Thanks!
Huanqing
Solution:
That is because there was a coordinate with 2 numbers (an array), so that they can't convert to a table variable and became blank. After I fixed this problem, all the columns show up as expected.

Accepted Answer

Shadaab Siddiqie
Shadaab Siddiqie on 5 Mar 2021
From my understanding you do not see elements in the csv file. This might be because you are adding duration, cell, etc type into your csv. To resolve this you can convert all the elements into string or double before adding it into the file.
  1 Comment
Huanqing Huang
Huanqing Huang on 7 Mar 2021
Thank you. I found the solution myself. It turned out duration are able to be converted into table and save into csv. The issue was I had some cell array with two elements in one coordinate, so they can only be in cell format and went blank in csv file.

Sign in to comment.

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!