How to loop CSVwrite

11 Ansichten (letzte 30 Tage)
Thamer
Thamer am 6 Mai 2014
Kommentiert: Thamer am 6 Mai 2014
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.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 6 Mai 2014
Bearbeitet: Azzi Abdelmalek am 6 Mai 2014
for i=1:10
filename = sprintf('Pressure%d.csv',i);
csvwrite(filename,P)
end
  1 Kommentar
Thamer
Thamer am 6 Mai 2014
Thanks appreciate the help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by