12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- function [attributes] = LoadAsciiAttributes(dataFilePath, dataFileName, numNodes, debug, debugPath)
-
- if nargin >= 3
- if nargin < 4
- debug = 0;
- end
- if nargin < 5
- debugPath = 'debug/';
- end
-
- dataFullName = strcat(dataFilePath,dataFileName);
- outFullPath = strcat(dataFilePath, debugPath);
- outFullName = strcat(outFullPath,dataFileName);
-
- if isdir(outFullPath) == 0 && debug == 1
- mkdir(outFullPath);
- end
-
-
- data = load(dataFullName);
- m = size(data,1);
- n = size(data,2);
-
- if m ~= numNodes
- fprintf('LoadAsciiAttributes - Invalid size: expecting %d, got %d\n',numNodes,m);
- return;
- end
-
-
- attributes = zeros(numNodes,n-1);
-
- for line=1:m
- id = data(line,1)+1;
- for col=2:n
- attributes(id,col-1) = data(line,col);
- end
- end
-
- if debug == 1
- save(strcat(outFullName,'.att.mat'), 'attributes');
- SaveIntMatrixToFile(strcat(outFullName,'.att.txt'), attributes);
- end
-
- else
- fprintf('Invalid parameters. expecting: dataFilePath, dataFileName, numNodes\n');
- end
|