While I was working on this I see you have already received an answer. This is probably similar to what Mathieu has already submitted, but since I had already spent time preparing it I'll provide it as an alternative. I like to put leading zeros on my filenames e.g. txt00001.csv, txt0002.csv, ... txt0999.csv, txt1000.csv as you can then easily retrieve them in alphabetical (dictionary) order.
baseName = 'txt'
A = rand(1000,2)
numRows = size(A,1);
for k = 1:numRows
filename = [baseName,num2str(k,'%04d'),'.csv'];
writematrix(A(k,:),filename)
end
0 Comments
Sign in to comment.