%Nearest Neighbor for Concatenated Results

UnfilteredClass = [];
FilteredClass = [];
SmallNoiseClass = [];
BigNoiseClass = [];

for v = 1:length(Unfiltered)
    if Unfiltered(v,1) == 5
        UnfilteredClass = [UnfilteredClass; Unfiltered(v,2)];
    end
end
        
 for v = 1:length(Filtered)
    if Filtered(v,1) == 5
        FilteredClass = [FilteredClass; Filtered(v,2)];
    end
 end      

 for v = 1:length(SmallNoise)
    if SmallNoise(v,1) == 5
        SmallNoiseClass = [SmallNoiseClass; SmallNoise(v,2)];
    end
 end

 for v = 1:length(BigNoise)
    if BigNoise(v,1) == 5
        BigNoiseClass = [BigNoiseClass; BigNoise(v,2)];
    end
 end

 
 
[FiltID FiltDist] = kNearestNeighbors(UnfilteredClass, FilteredClass, 1);
[SmallNoiseID SmallNoiseDist] = kNearestNeighbors(UnfilteredClass, SmallNoiseClass, 1);
[BigNoiseID BigNoiseDist] = kNearestNeighbors(UnfilteredClass, BigNoiseClass, 1);

FiltResults = [FiltID FiltDist];
SmallNoiseResults = [SmallNoiseID SmallNoiseDist];
BigNoiseResults = [BigNoiseID BigNoiseDist];