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: test_meg_leadfield_units.m
    path of file: ./repos/fieldtrip/test
    
    the code of the file until where you have to start completion: function test_meg_leadfield_units

% MEM 1gb
% WALLTIME 00:10:00
% DEPENDENCY ft_convert_units ft_datatype_sens ft_convert_vol_sens ft_compute_leadfield current_dipole
% DATA public

%% do a forward computation for a single vector magnetometer
clear all

grad = [];
grad.coilpos = [0 0 12; 0 0 12; 0 0 12];
grad.coilori = eye(3);
grad.label = {'Hx'; 'Hy'; 'Hz'};
grad.unit = 'cm';

% the implementation for the current dipole in an homogenous infinite medium
% returns correct values for inputs that are in SI units
vol0 = [];
vol0.type = 'infinite_currentdipole';
vol0.unit = 'm';

vol1 = [];
vol1.type = 'singlesphere';
vol1.unit = 'cm';

    
function test_meg_leadfield_units

% MEM 1gb
% WALLTIME 00:10:00
% DEPENDENCY ft_convert_units ft_datatype_sens ft_convert_vol_sens ft_compute_leadfield current_dipole
% DATA public

%% do a forward computation for a single vector magnetometer
clear all

grad = [];
grad.coilpos = [0 0 12; 0 0 12; 0 0 12];
grad.coilori = eye(3);
grad.label = {'Hx'; 'Hy'; 'Hz'};
grad.unit = 'cm';

% the implementation for the current dipole in an homogenous infinite medium
% returns correct values for inputs that are in SI units
vol0 = [];
vol0.type = 'infinite_currentdipole';
vol0.unit = 'm';

vol1 = [];
vol1.type = 'singlesphere';
vol1.unit = 'cm';
vol1.r = 10;
vol1.o = [0 0 0];

grad = ft_datatype_sens(grad);
grad = ft_convert_units(grad, 'm');
vol0 = ft_convert_units(vol0, 'm');
vol1 = ft_convert_units(vol1, 'm');

dip = [0 0 0.08]; % in meter

lf0 = ft_compute_leadfield(dip, grad, vol0);
lf1 = ft_compute_leadfield(dip, grad, vol1);

n0 = norm(lf0);
n1 = norm(lf1);
% it should be exactly 1/3
assert(n1/n0 < 0.35);
assert(n1/n0 > 0.31);

%% do a forward computation for a more realistic sensor layout
clear all

[pnt, tri] = mesh_sphere(162);
sel = find(pnt(:,3)>0);

grad = [];
grad.pnt = pnt(sel,:) .* 12; % distributed on a 12 cm sphere
grad.ori = pnt(sel,:);
grad.tra = eye(length(sel));
for i=1:length(sel)
  grad.label{i} = sprintf('magnetometer%d', i);
end