writematrix for multiple csv files

14 vues (au cours des 30 derniers jours)
Brie E.
Brie E. le 15 Juin 2020
Commenté : Brie E. le 16 Juin 2020
Hello,
Essnetially I am attempting to achieve the following:
writematrix (PhaseAve{i, 1}, 'INTL_i.csv')
but I am unsure what the proper formatting is such that the file renames each i-th iteration.
I have utilized the following code to break out unique file names for each iteration, but now I am not sure how to reference that file name that corresponds to the i-th iteration. The first section succeeds in naming the files however the code gets stuck on the second section so I think that is where my formatting errors lie.
%%%% naming each file
i = 1: length(a);
BaseName='INTL_';
for k=1:875
FileName=[BaseName,num2str(k), '.csv'];
end
%%%% writing to each file
while i <= a
writematrix(PhaseAve{iii,1},FileName)
end
I know this is probably super basic...and I may not be explaining it well. Thanks for any advice in advance.
This is a long-form illustration of the result I am trying to achieve:
writematrix (PhaseAve{1,1},'INTL_1.csv')
writematrix (PhaseAve{2,1},'INTL_2.csv')
writematrix (PhaseAve{3,1},'INTL_3.csv')
writematrix (PhaseAve{4,1},'INTL_4.csv')
writematrix (PhaseAve{5,1},'INTL_5.csv')
writematrix (PhaseAve{6,1},'INTL_6.csv')
writematrix (PhaseAve{7,1},'INTL_7.csv')
writematrix (PhaseAve{8,1},'INTL_8.csv')
writematrix (PhaseAve{9,1},'INTL_9.csv')
writematrix (PhaseAve{10,1},'INTL_10.csv')
%through
writematrix (PhaseAve{875, 1}, 'INTL_875.csv')

Réponse acceptée

madhan ravi
madhan ravi le 15 Juin 2020
  1 commentaire
Brie E.
Brie E. le 16 Juin 2020
Thank you thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by