You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SavePropertiesData.m 660B

12345678910111213141516171819202122232425
  1. function [network] = SavePropertiesData(filePrefix, network, properties, numNodes)
  2. fprintf('saving properties data %s ...\n',filePrefix);
  3. n = size(network,1);
  4. m = size(network,2);
  5. fileID1 = fopen(strcat(filePrefix,'_1.txt'),'w');
  6. fileID2 = fopen(strcat(filePrefix,'_2.txt'),'w');
  7. if nargin >= 4
  8. fprintf(fileID1,'%%Nodes\t%d\n',numNodes);
  9. end
  10. for i=1:n
  11. for j=1:m
  12. if network(i,j) == 1
  13. fprintf(fileID1,'%d\t%d\t%d\n',i,j,properties(i,j));
  14. elseif i~=j && properties(i,j) > 0
  15. fprintf(fileID2,'%d\t%d\t%d\n',i,j,properties(i,j));
  16. end
  17. end
  18. end
  19. fclose(fileID1);
  20. fclose(fileID2);