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: standardize.m
    path of file: ./repos/BRAPH-2/braph2genesis/src/gt
    
    the code of the file until where you have to start completion: function B = standardize(A, varargin)
%STANDARDIZE normalizes a matrix
%
% B = STANDARDIZE(A) normalizes the matrix A in order to have its values
%  scaled between 0 and 1 by using the default RULE 'threshold'.
%
% B = STANDARDIZE(A, 'StandardizeRule', RULE) 

    
function B = standardize(A, varargin)
%STANDARDIZE normalizes a matrix
%
% B = STANDARDIZE(A) normalizes the matrix A in order to have its values
%  scaled between 0 and 1 by using the default RULE 'threshold'.
%
% B = STANDARDIZE(A, 'StandardizeRule', RULE) 
%  normalizes the matrix A using the specified RULE.
%  Admissible RULE options are:
%  RULE = 'threshold' (default) normalizes the matrix A following one-rule: 
%                               by converting negative values to zero and
%                               values larger than 1 to 1.
%         'range'               normalizes the matrix A in order to have
%                               values scaled between 0 and 1 by using a
%                               linear function.
%
% See also BINARIZE, DEDIAGONALIZE, DIAGONALIZE, SEMIPOSITIVIZE, SYMMETRIZE.

standardize_rule = get_from_varargin('threshold', 'StandardizeRule', varargin);

switch lower(standardize_rule)
    case 'range'  % scaled interval
        if min(A(:)) ~= max(A(:))
            B = (A - min(A(:))) / (max(A(:)) - min(A(:)));
        else
            B = binarize(A);
        end