How can I writetable to cell array

9 vues (au cours des 30 derniers jours)
Craig Saunders
Craig Saunders le 31 Juil 2020
Commenté : Craig Saunders le 31 Juil 2020
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!

Réponse acceptée

Stephen23
Stephen23 le 31 Juil 2020
Modifié(e) : Stephen23 le 31 Juil 2020
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 commentaire
Craig Saunders
Craig Saunders le 31 Juil 2020
Thank you very much! Worked perfectly.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Identification dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by