how to combine datetime array with cell array for export?

Hi
I have one 1000 by 1 string cell array and one 1000 by 1 datetime array. I'd like to combine them together so export. Here is the code I have
A=datetime(datestr(wellcyclestartdate,'yyyy-mm-dd'));
A look like this:
Jan 1 2000
Jan 2 2000
...
Jan 1 2021
B look like this:
{'A1}
{'A2'}
.....
{'A1000'}
Then, I combine them together using below
export={B,A}
writecell(export,export_filename,'QuoteStrings',true) ;
I got an error of Nested cell arrays are not supported. I am thinking maybe I need to convert B cell array to text array? Any suggestion? Thanks

 採用された回答

Stephen23
Stephen23 2021 年 7 月 14 日

1 投票

T = table(A,B);
writetable(T,...)

1 件のコメント

roudan
roudan 2021 年 7 月 14 日
Yes it works perfectly. Thank you Stephen! I appreciate it. You saved me almost whole morning time.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

製品

リリース

R2020a

質問済み:

2021 年 7 月 14 日

コメント済み:

2021 年 7 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by