Cell array after cell2table command in MATLAB 2020a

2 次查看(过去 30 天)
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.

采纳的回答

Shadaab Siddiqie
Shadaab Siddiqie 2021-3-5
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 个评论
Huanqing Huang
Huanqing Huang 2021-3-7
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.

请先登录,再进行评论。

更多回答(0 个)

类别

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