GetIntervalsArff.m 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. % function GetIntervalsArff:
  2. %
  3. % Uses the data loaded from an ARFF file along with an attribute name and type
  4. % of eye movement and returns the intervals for the specific eye movement.
  5. %
  6. % input:
  7. % data - data loaded from ARFF file with LoadArff
  8. % arffAttributes - attributes returned from LoadArff
  9. % attribute - attribute to consider for interval counting
  10. % moveId - id for eye movement to consider
  11. %
  12. % output:
  13. % intervals - nx6 array (start time, start x, start y, end time, end x, end y)
  14. function [intervals] = GetIntervalsArff(data, arffAttributes, attribute, moveId)
  15. intervalIndices = GetIntervalsIndexArff(data, arffAttributes, attribute, moveId);
  16. % initialize data
  17. intervals = zeros(size(intervalIndices,1),6);
  18. % find position of attribute in data
  19. timeIndex = GetAttPositionArff(arffAttributes, 'time');
  20. xIndex = GetAttPositionArff(arffAttributes, 'x');
  21. yIndex = GetAttPositionArff(arffAttributes, 'y');
  22. for i=1:size(intervals,1)
  23. startIndex = intervalIndices(i,1);
  24. endIndex = intervalIndices(i,2);
  25. intervals(i,:) = [data(startIndex,timeIndex) data(startIndex,xIndex) data(startIndex,yIndex) data(endIndex,timeIndex) data(endIndex,xIndex) data(endIndex,yIndex)];
  26. end
  27. end