How to combine multi column cell in table with commas for excel?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi, I have made a table in Matlab with various columns. Some cells of the table (for example for columns A and B) have multiple columns.
When I export this to excel it divides these up and gives me a format of columns with A_1,A_2,A_3 etc.
The data is actually a triplet of datapoints, so I want to combine the data for A into one column by using commas as a deliminator.
So for example, get an output with the first row of column A saying 33.08,24.23,5.0506
I assume I somehow need to combine the datapoints with commas before creating the table.
Is there any way to do this?
Thank you very much,
Eva
댓글 수: 0
답변 (1개)
Navya Seelam
2020년 2월 21일
You can try creating table from string array rather than numeric array to combine the data for A into one column as shown below
A=[133.08 24.23 5.0506;114.65 -33.555 12.999];
Astr=num2str(A,'%5f,');
T=table(Astr(:,1:end-1));
writetable(T,'data.xlsx');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!