How to loop CSVwrite

11 views (last 30 days)
Thamer
Thamer on 6 May 2014
Commented: Thamer on 6 May 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.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 6 May 2014
Edited: Azzi Abdelmalek on 6 May 2014
for i=1:10
filename = sprintf('Pressure%d.csv',i);
csvwrite(filename,P)
end

More Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!