You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: brute.m
    path of file: ./repos/hctsa/Toolboxes/OpenTSTOOL/mex-dev/NN/TestSuite
    
    the code of the file until where you have to start completion: function [indices, distances] = brute(points, refind, nnr, past)

% [indices, distances] = brute(points, refind, nnr, past)
%
% Brute force implementation of nearest neighbor search
%
% Input arguments :
% 
% points - N by D matrix of N points of dimension D
% refind - integer reference indices
% nnr - number of neighbor to find
% past - number of points to exclude before and after the actual reference index

    
function [indices, distances] = brute(points, refind, nnr, past)

% [indices, distances] = brute(points, refind, nnr, past)
%
% Brute force implementation of nearest neighbor search
%
% Input arguments :
% 
% points - N by D matrix of N points of dimension D
% refind - integer reference indices
% nnr - number of neighbor to find
% past - number of points to exclude before and after the actual reference index
%
% Output arguments :
%
% indices - R by nnr integer matrix containing the indices of the nearest neighbors, R = length(refind)
% dimension - R by nnr double matrix containing the distances to the nearest neighbors 
%
% Using euclidian norm

narginchk(2,4)

if nnr < 1
	error('At least one neighbor must be requested')
end