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: sel50p.m
    path of file: ./repos/fieldtrip/private
    
    the code of the file until where you have to start completion: function [grid] = sel50p(cfg, grid, sens)

% This function will add the field "subspace" to the grid definition.
%
% The subspace projection corresponds to selecting 50% of the 

    
function [grid] = sel50p(cfg, grid, sens)

% This function will add the field "subspace" to the grid definition.
%
% The subspace projection corresponds to selecting 50% of the 
% channels that are the closest to the dipole.

% set the defaults
if ~isfield(cfg, 'feedback'),   cfg.feedback = 'text';     end