123456789101112131415161718192021222324252627282930313233 |
- function [attData, totalAttNum] = PreProcessDataAttributes(data, attributes, attUpperRange)
-
- totalAttNum = sum(attUpperRange);
- attData = zeros(size(data,1), totalAttNum);
-
- numAttTypes = size(attUpperRange,2);
- attOffsets = zeros(numAttTypes,1);
-
- if (numAttTypes>1)
- for i=2:numAttTypes
- attOffsets(i) = attOffsets(i-1)+attUpperRange(i-1);
- end
- end
-
- dataLines = size(data,1);
- attLines = size(attributes,1);
- if (attLines ~= dataLines)
- fprintf('CombineDataWithAttributes - Invalid data sizes: data %d, attributes %d\n',dataLines,attLines);
- end
-
- for line=1:dataLines
- for att=1:numAttTypes
- value = attributes(line,att);
- if value > 0
- attData(line,attOffsets(att)+value)=1;
- end
- end
- end
-
- %attData = sparse(attData); %sigal 12.6.13 - use sparse
-
- end %function
-
|