How write to CSV(of column matrix

4 次查看(过去 30 天)
Hi,
I Have a four column matrix.I used cell2csv to write to csv file. By using cell2csv it wrote to only four column with space.
My matrix is:
column1 column2 Date rank
Name1 name2 2016/3/03 00:43:4.567 12
But when it wrote to CSV:
Name1 name2 2016/3/03 00:43:4.567 12
all in single column with space between each content of four columns. How to write to column matrix.
Many thanks in advance,
  3 个评论
Walter Roberson
Walter Roberson 2016-3-5
Is your 2016/3/03 00:43:4.567 a datetime object or is it a string?
Have you considered using tables and writetable() ? http://www.mathworks.com/help/matlab/ref/writetable.html
writetable() itself requires R2013b or later, but datetime objects require R2014b or later.
Mekala balaji
Mekala balaji 2016-3-5
My Matlab version is 2012b. My input is "2016/3/03 00:43:4.567" is a cell.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2016-3-5
cell2csv is not part of MATLAB. There is a File Exchange Contribution http://www.mathworks.com/matlabcentral/fileexchange/7601-cell2csv/content/cell2csv.m . Unfortunately that code is clearly broken -- it uses eval to construct values, so it is going to get some values wrong.

Community Treasure Hunt

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

Start Hunting!

Translated by