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: dba_vol_grids.m
    path of file: ./repos/brainstorm3/external/dba
    
    the code of the file until where you have to start completion: function [SourceLoc] = dba_vol_grids(tess)
% function [SourceLoc] = vol_grids(tess)
%
% Function to create a 3D grid inside a surfacic mesh
%
% input : tess is a surfacic mesh:
%           - tess.Vertices [nbVert x 3]
%           - tess.Faces [nbFacs x 3]
%
% output: SourceLoc is the matrix of positions [nbLoc x 3]
%
% Yohan Attal - HM-TC project 2011

fac  = tess.Faces;
vert = tess.Vertices;

% Creation of the volumic grid with a step "p" in a rectangular
% parallelepipede containing the surfacic mesh
Xmax = max(vert(:,1));
Xmin = min(vert(:,1));
Ymax = max(vert(:,2));

    
function [SourceLoc] = dba_vol_grids(tess)
% function [SourceLoc] = vol_grids(tess)
%
% Function to create a 3D grid inside a surfacic mesh
%
% input : tess is a surfacic mesh:
%           - tess.Vertices [nbVert x 3]
%           - tess.Faces [nbFacs x 3]
%
% output: SourceLoc is the matrix of positions [nbLoc x 3]
%
% Yohan Attal - HM-TC project 2011

fac  = tess.Faces;
vert = tess.Vertices;

% Creation of the volumic grid with a step "p" in a rectangular
% parallelepipede containing the surfacic mesh
Xmax = max(vert(:,1));
Xmin = min(vert(:,1));
Ymax = max(vert(:,2));
Ymin = min(vert(:,2));
Zmax = max(vert(:,3));
Zmin = min(vert(:,3));

% compute volume of the mesh in order to define the grid step
V = dba_mesh_volume(tess);
V = V*10e6;

if V<5
    p = 0.002;
elseif V<15
    p = 0.003;
else
    p = 0.004;
end