【发布时间】:2019-11-24 20:43:06
【问题描述】:
[r1 c1]= size(cluster_head);
r1
fid=fopen('na.txt','w');
for f=1:r1
f
for m = 1:c1
%value of cluster in chrosome
a= cluster_head(1,m);
temp = find(neighbors1(cluster_head(1,m),:));
disp('neighbour')
temp
[r c]= size(temp);
k(1,1)=cluster_head(1,m);
for n=2:c+1
if(temp(1,n-1)~=k(1,1))
k(f,n)= temp(1,n-1);
save solution.txt k(f,n) -ASCII
end
end
fprintf('%d Iterations completed\n',m);
end
end
需要k(f,n)逐行保存在文本文件中。
但是 solution.txt 只存储第一行中的最后一个解决方案值,覆盖所有其他或以前的解决方案。
【问题讨论】:
-
欢迎哈马德。请尝试format您的帖子,并提供mcve examples以显示问题。
标签: matlab save text-files