distances calculates the distance between each pair of vectors. Usage: distances(A, B) For each row in A, takes the corresponding row in B, and calculates the Euclidean distance between the two vectors represented by the rows. A and B should have the same dimensions, or else B should have the same number of columns in A and one row, in which case the distance from B to each row of A is calculated. This is performed in a vectorized way, so it should be quite fast.

- distances distances calculates the distance between each pair of vectors.

- cont_speed cont_speed calculates the speed based on a continuous position.
- make_gaze_to_center finds the centroid of a cluster of gaze data points, and then calcuates
- detect_movement Detect_movement examines position data to return a cevent
- detect_moving_event Detect_moving_event examines position data to return a cevent
- distances distances calculates the distance between each pair of vectors.
- vector_distances distances calculates the distance between each pair of vectors.

0001 function distances = distances(A, B) 0002 % distances calculates the distance between each pair of vectors. 0003 % 0004 % Usage: 0005 % distances(A, B) 0006 % For each row in A, takes the corresponding row in B, and calculates the 0007 % Euclidean distance between the two vectors represented by the rows. A 0008 % and B should have the same dimensions, or else B should have the same 0009 % number of columns in A and one row, in which case the distance from B 0010 % to each row of A is calculated. 0011 % 0012 % This is performed in a vectorized way, so it should be quite fast. 0013 % 0014 0015 if size(A) == size(B) 0016 D = A - B; 0017 else 0018 if size(B, 1) ~= 1 0019 error('The second arg must be the same size as the first, or have one row.'); 0020 end 0021 D = bsxfun(@minus, A, B); 0022 end 0023 distances = sqrt(sum(D.*D, 2));

Generated on Tue 23-May-2017 03:00:58 by