我有大约2000条数据,大小为7611 * 1。我想将每个数据另存为txt文件。我想以1.txt,2.txt,3.txt ...格式保存txt文件名,该怎么办?
另外,在保存数据时,我想将其保留为7611 * 1格式,该怎么办?在这一部分中,我将附加我编写的无法正常工作的代码。 请帮忙。谢谢。
st = data which size is 7611*1
for i = 1:2000
data = fopen('%d.txt','w',i); % The next code doesn't work. I wrote this code
% to tell you what form I want.
fprintf(data,'%d \n',st); % I want to save as a column vector, but when I
% run it with the code next to it, the broken
% txt file is saved... I cant find reason..
end
I recommend using the
sprintf
command inside your for loop to create the file name, i.e.,