From 0da8dc6e7aa8b4addc6d24edc147892ce51645f8 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Wed, 19 Sep 2018 09:41:07 -0600 Subject: [PATCH] Fixed lookup for animal id --- MATLAB/beefblup.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MATLAB/beefblup.m b/MATLAB/beefblup.m index 957045c..53c29b5 100644 --- a/MATLAB/beefblup.m +++ b/MATLAB/beefblup.m @@ -28,8 +28,8 @@ data = sortrows(data,2); % Create a lookup lambda function to find the animal represented by a % certain id -ids = data(:,1); -animalrow = @(id) find(ids == id); +animalrow = @(id) find(strcmp(data(:,1), id)); +ids = [data{:,1}]; numanimals = length(ids); % Store column numbers that need to be deleted @@ -114,4 +114,7 @@ for i = 1:length(normal) X(matchedindex, I) = 1; I = I + 1; end -end \ No newline at end of file +end + +% Create an empty matrix for the additive relationship matrix +A = sparse(numanimals, numanimals); \ No newline at end of file