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: prepare_bd_data_3d.m
    path of file: ./repos/freefem_matlab_octave_plot/release-v2.0/demos/ffmatlib
    
    the code of the file until where you have to start completion: %% Calculate the coordinates necessary to plot the colored data
%
%  Author: Chloros2 <chloros2@gmx.de>
%  Created: 2018-12-18
%
% 
    
function data at the boundaries to euclidean coordinates
%Data in points/vertex format (P1-Simulation): Works for P1 FE-space only
function [elementType, varargout] = prepare_bd_data_3d(vhseq,nv,triangles,tetrahedra,xyzrawdata,bdlabels)
    [~,nt]=size(tetrahedra);
    [ndim,ndof]=size(xyzrawdata);
    if (~isempty(vhseq))
        if (max(vhseq+1)~=length(xyzrawdata(1,:)))
            error('Datalength of PDE data ''XYData'' or ''FlowData'' does not match with Vh-Space connectivity ''VhSeq''');
        end