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.

SaveIntMatrixToFile.m 357B

12345678910111213141516171819
  1. function [matrix] = SaveIntMatrixToFile(fullFileName, matrix, numNodes)
  2. n = size(matrix,1);
  3. m = size(matrix,2);
  4. fileID = fopen(fullFileName,'w');
  5. if nargin >= 3
  6. fprintf(fileID,'%%Nodes\t%d\n',numNodes);
  7. end
  8. for i=1:n
  9. for j=1:m
  10. fprintf(fileID,'\t%d',matrix(i,j));
  11. end
  12. fprintf(fileID,'\n');
  13. end
  14. fclose(fileID);