필터 지우기
필터 지우기

writematrix for multiple csv files

조회 수: 6 (최근 30일)
Brie E.
Brie E. 2020년 6월 15일
댓글: Brie E. 2020년 6월 16일
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')

채택된 답변

madhan ravi
madhan ravi 2020년 6월 15일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Generation, GPU, and Third-Party Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by