Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.70 KB | None | 0 0
  1. % array of struct containing the iriscode of the 20 persons
  2. person = repmat(struct('iriscode', []), 20, 1);
  3.  
  4. % loading files
  5. for i=1:20
  6.     filename = sprintf('lab_week2_data/person%02d.mat', i);
  7.     person(i) = load(filename);
  8. end
  9.  
  10. S = zeros(1, 1000);
  11. for i=1:1000
  12.     % random person
  13.     random_iriscode = person(randi(20)).iriscode;
  14.     % random permutation of rows to be sure that we don't pick the same row
  15.     iriscode_perm = randperm(20);
  16.     % the first two rows with the iriscode
  17.     row1 = random_iriscode(iriscode_perm(1), :);
  18.     row2 = random_iriscode(iriscode_perm(2), :);
  19.     xor1 = xor(row1, row2);
  20.     % normalized hamming distance
  21.     %S(i) = sum(xor(row1, row2) == 1) / 30;
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement