How to export multiple tables within a cell array with a foor loop

Hello, I have a cell-array with 1xn tables within it. I would like to export every table as a seperate .csv file which has the running table number in its name.
So for exaple table {1,1} should be named 'measurement_1_table.csv', table {1,2} ' measurement_2_table.csv' and so on.
How can I do this in a for-loop?

 Accepted Answer

Folder = 'C:\Where\To\Write';
for k = 1:numel(YourCell)
File = fullfile(Folder, sprintf('measurement_%d_table.csv', k));
writetable(YouCell{k}, File);
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Release

R2020a

Asked:

on 27 Mar 2021

Edited:

on 1 Apr 2021

Community Treasure Hunt

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

Start Hunting!