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.

PreProcessDataAttributes4.m 915B

123456789101112131415161718192021222324252627282930313233
  1. function [attData, totalAttNum] = PreProcessDataAttributes4(data, attributes, attUpperRange, selectedAttInx)
  2. totalAttNum = sum(attUpperRange(selectedAttInx));
  3. attData = zeros(size(data,1), totalAttNum);
  4. numAttTypes = size(selectedAttInx,2); %size(attUpperRange,2);
  5. attOffsets = zeros(numAttTypes,1);
  6. if (numAttTypes>1)
  7. for i=2:numAttTypes
  8. attOffsets(i) = attOffsets(i-1)+attUpperRange(selectedAttInx(i-1));
  9. end
  10. end
  11. dataLines = size(data,1);
  12. attLines = size(attributes,1);
  13. if (attLines ~= dataLines)
  14. fprintf('CombineDataWithAttributes - Invalid data sizes: data %d, attributes %d\n',dataLines,attLines);
  15. end
  16. for line=1:dataLines
  17. for att=1:numAttTypes
  18. value = attributes(line,selectedAttInx(att));
  19. if value > 0
  20. attData(line,attOffsets(att)+value)=1;
  21. end
  22. end
  23. end
  24. %attData = sparse(attData);
  25. end %function