how to combine datetime array with cell array for export?

조회 수: 6 (최근 30일)
roudan
roudan 2021년 7월 14일
댓글: roudan 2021년 7월 14일
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일
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개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by