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: exportX3D.m
    path of file: ./repos/ValoMC
    
    the code of the file until where you have to start completion: function exportX3D(filename, vertices, mesh, value, colormap)
%EXPORTX3D Export the mesh into X3D format
%
%       exportX3D(filename, vertices, mesh, value, colormap)
%
% DESCRIPTION:
%
%       Export the mesh to X3D format for use in e.g. 3d modeling
%       software.  The mesh has to be a three dimensional, i.e. to
%       consists of tetrahedrons. Each tetrahedron will be stored as 4
%       triangles.  The triangles will be colored according to
%       'colormap' and 'value'. The length of 'value' is equal to the
%       number of tetrahedrons
%
% USAGE:
%
%       exportX3D('mouse.x3d', vmcmesh.r,vmcmesh.H, solution.element_fluence, @parula)
%       exportX3D('mouse.xhtml', vmcmesh.r, vmcmesh.H, solution.element_fluence, @jet)
%
% INPUTS:

    
function exportX3D(filename, vertices, mesh, value, colormap)
%EXPORTX3D Export the mesh into X3D format
%
%       exportX3D(filename, vertices, mesh, value, colormap)
%
% DESCRIPTION:
%
%       Export the mesh to X3D format for use in e.g. 3d modeling
%       software.  The mesh has to be a three dimensional, i.e. to
%       consists of tetrahedrons. Each tetrahedron will be stored as 4
%       triangles.  The triangles will be colored according to
%       'colormap' and 'value'. The length of 'value' is equal to the
%       number of tetrahedrons
%
% USAGE:
%
%       exportX3D('mouse.x3d', vmcmesh.r,vmcmesh.H, solution.element_fluence, @parula)
%       exportX3D('mouse.xhtml', vmcmesh.r, vmcmesh.H, solution.element_fluence, @jet)
%
% INPUTS:
%
%       filename       - see usage example
%       vertices       - vector for node coordinates
%       mesh           - tetrahederal mesh: indices to vertices
%       value          - value for each tetrahedron
%       colormap       - colormap function for determining the
%                        color of each triangle from 'value'
%
%
%  This function is provided with ValoMC

% determine if xhtml header is needed

[~,~,ext] = fileparts(filename);

is_xhtml = false;

if(strcmp(ext,'.xhtml')) 
    is_xhtml=true;
end