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: SB2_PreProcessBasis.m
    path of file: ./repos/RVM-MATLAB/SB2_Release_200
    
    the code of the file until where you have to start completion: % SB2_PREPROCESSBASIS  Do basis matrix pre-processing for SPARSEBAYES
%
% [BASIS, SCALES] = SB2_PREPROCESSBASIS(BASIS)
%
% OUTPUT ARGUMENTS:
%
%	BASIS	NxM matrix of basis vectors appropriately pre-processed
%			(scaled to unit length per colu
    
function [BASIS, Scales] = SB2_PreProcessBasis(BASIS)

%
[N,M]	= size(BASIS);
%
% Compute "lengths" of basis vectors (columns of BASIS)
% 
Scales	= sqrt(sum(BASIS.^2));
%
% Work-around divide-by-zero inconvenience
% 
Scales(Scales==0)	= 1;
%
% Normalise each basis vector to "unit length"
% 
for m=1:M
  BASIS(:,m)	= BASIS(:,m) / Scales(m);
end