How to loop CSVwrite

조회 수: 11 (최근 30일)
Thamer
Thamer 2014년 5월 6일
댓글: Thamer 2014년 5월 6일
I'm trying to create a new data set in CSV format for each loop as I do not want to overwrite the CSV file.
Below is what I have inside the loop but of course it will overwrite through the loop. What I want to output is Pressure1, Pressure2 and so on. My variable is P for pressures in the code.
For i=1:10
filename = 'Pressure.csv';
csvwrite('Pressure',P')
end
I'd appreciate your help.
Thanks in advance.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 6일
편집: Azzi Abdelmalek 2014년 5월 6일
for i=1:10
filename = sprintf('Pressure%d.csv',i);
csvwrite(filename,P)
end
  댓글 수: 1
Thamer
Thamer 2014년 5월 6일
Thanks appreciate the help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by