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: ToPrXML.m
    path of file: ./repos/Bilibili346623/MATLAB/GUI/VADPrXML
    
    the code of the file until where you have to start completion: function ToPrXML(timestamp,xmlfilename)
%% 写入XML
%创建根结点
global docNode
docNode = com.mathworks.xml.XMLUtils.createDocument('xmeml');
docRootNode = docNode.getDocumentElement;
docRootNode.setAttribute('version','4');
% 创建sequence元素
thisElement = docNode.createElement('sequence');
% duration
newElement=docNode.createElement('duration');
newElement.appendChild(docNode.createTextNode('0'));
thisElement.appendChild(newElement);
% rate
newElement=docNode.createElement('rate');
newEle2=docNode.createElement('timebase');
newEle2.appendChild(docNode.createTextNode('30'));
newElement.appendChild(newEle2);
newEle2=docNode.createElement('ntsc');
newEle2.appendChild(docNode.createTextNode('TRUE'));
newElement.appendChild(newEle2);
thisElement.appendChild(newElement);

    
function ToPrXML(timestamp,xmlfilename)
%% 写入XML
%创建根结点
global docNode
docNode = com.mathworks.xml.XMLUtils.createDocument('xmeml');
docRootNode = docNode.getDocumentElement;
docRootNode.setAttribute('version','4');
% 创建sequence元素
thisElement = docNode.createElement('sequence');
% duration
newElement=docNode.createElement('duration');
newElement.appendChild(docNode.createTextNode('0'));
thisElement.appendChild(newElement);
% rate
newElement=docNode.createElement('rate');
newEle2=docNode.createElement('timebase');
newEle2.appendChild(docNode.createTextNode('30'));
newElement.appendChild(newEle2);
newEle2=docNode.createElement('ntsc');
newEle2.appendChild(docNode.createTextNode('TRUE'));
newElement.appendChild(newEle2);
thisElement.appendChild(newElement);
%% name
newElement=docNode.createElement('name');
newElement.appendChild(docNode.createTextNode('series02'))
thisElement.appendChild(newElement)

%% media
newElement = docNode.createElement('media');
    %% video
    videoEle=docNode.createElement('video');
        % format
        formatEle=docNode.createElement('format');
        formatEle.appendChild(createSample());
        videoEle.appendChild(formatEle);
        % track
        trackEle= docNode.createElement('track');
         
        % 添加视频
        for i=1:size(timestamp)
          tstart=num2str(timestamp(i));
          tend