How can I writetable to cell array

조회 수: 9 (최근 30일)
Craig Saunders
Craig Saunders 2020년 7월 31일
댓글: Craig Saunders 2020년 7월 31일
Hi,
I have a cell array of tables. I want to write these individual tables stored within the cell array to .csv. Using cell2table merges the tables which is not what I want. Please could someone provide an example code of how to write tables stored within a cell array to .csv. I'm assuming this can be done via a loop however after hours of searching I've had no luck. Many thanks!

채택된 답변

Stephen23
Stephen23 2020년 7월 31일
편집: Stephen23 2020년 7월 31일
Where C is your cell array:
for k = 1:numel(C)
F = sprintf('file_%d.CSV',k);
writetable(C{k},F)
end
This just follows the examples in the MATLAB documentation:
  댓글 수: 1
Craig Saunders
Craig Saunders 2020년 7월 31일
Thank you very much! Worked perfectly.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by