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: veres2vessel.m
    path of file: ./repos/MSS/HYDRO
    
    the code of the file until where you have to start completion: function vessel = veres2vessel(filename, plot_flag)
% veres2vessel reads data from ShipX output files and store the data in 
% vesselname.mat using the MSS vessel struture.
%
%   vessel = veres2vessel(filename, disp_flag) 
%
%   Examples:
%
%    veres2vessel('input') 
%    veres2vessel('input','1111') 
%
% where input are the Shipx (Veres) output data file name.
% 
% Inputs:
%   filename: *  (without extension) reads and processes the following
%                 ShipX (Veres) files:                
%                    *.re1  motion RAOs (vessel.motionRAO)
%                    *.re2  wave drift data (vessel.driftfrc)
%                    *.re7  added mass, damping, restoring forces
%                    *.re8  force RAOsu (vessel.forceRAO)
%

    
function vessel = veres2vessel(filename, plot_flag)
% veres2vessel reads data from ShipX output files and store the data in 
% vesselname.mat using the MSS vessel struture.
%
%   vessel = veres2vessel(filename, disp_flag) 
%
%   Examples:
%
%    veres2vessel('input') 
%    veres2vessel('input','1111') 
%
% where input are the Shipx (Veres) output data file name.
% 
% Inputs:
%   filename: *  (without extension) reads and processes the following
%                 ShipX (Veres) files:                
%                    *.re1  motion RAOs (vessel.motionRAO)
%                    *.re2  wave drift data (vessel.driftfrc)
%                    *.re7  added mass, damping, restoring forces
%                    *.re8  force RAOsu (vessel.forceRAO)
%
%    plot_flag (optionally): '1000' plot A and B matrices
%			                 '0100' plot force RAOs
%                            '0010' plot motion RAOs
%                            '0001' plot wave drift forces
%                            '0000' NO PLOT
%                            '1111' PLOT ALL
%
% Outputs:
% vessel contains data in the following form (saved to vesselname.mat):
%
%    vessel.headings:                     headings
%    vessel.velocities:                   velocities
%    vessel.freqs:                        frequencies (A and B matrices)
%
%    vessel.A(6,6,freqno,velno):          added mass matrix
%    vessel.B(6,6,freqno,velno):          damping matrix
%    vessel.C(6,6,freqno,velno):          spring stiffness matrix
%    vessel.MRB(6,6):                     rigid-body mass matrix
%
%    vessel.driftfrc.
%       amp(freqno,headno,velno):         wave drift force amplitudes
%       w(1,freqno):                      circular wave frequencies
%
%    vessel.forceRAO.
%       amp{1:6}(freqno,headno,velno):    wave excitation force amplitudes
%       phase{1:6}(freqno,headno,velno):  wave excitation force phases
%       w(1,freqno):                      circular wave frequencies
%
%    vessel.motionRAO.
%       amp{1:6}(freqno-n,headno,velno):   wave motion RAO amplitudes
%       phase{1:6}(freqno-n,headno,velno): wave motion RAO phases
%       w(1,freqno-n):                     circular wave frequencies where n>=0
%                                          is chosen such that w_o > w_min
%                                          (typically w_min = 0.2 rad/s)
%
%    vessel.main.
%       name:  vessel name
%       m:     mass
%       rho    density of water
%       nabla: displacement volume
%       k44:   radius of inertia 
%       k55:   radius of inertia 
%       k66:   radius of inertia 
%       m:     mass
%       CG:    centre of gravity  [LCG 0 VCG] w.r.t. Lpp/2 and Keel Line
%       CB:    centre of buoyancy [LCB 0 VCB] w.r.t. Lpp/2 and Keel Line
%       Lpp:   length between the perpend