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: writemdcrd.m
    path of file: ./repos/mdtoolbox/mdtoolbox
    
    the code of the file until where you have to start completion: function writemdcrd(filename, trj, box, title)
%% writemdcrd

    
function writemdcrd(filename, trj, box, title)
%% writemdcrd
% write amber ascii-format trajectory format file
%
%% Syntax
%# writemdcrd(filename, trj)
%# writemdcrd(filename, trj, box)
%# writemdcrd(filename, trj, box, title)
%# writemdcrd(filename, trj, [], title)
%
%% Description
% This code puts trajectories into an amber trajectory format file. 
% If box information is given, box sizes are appended.
%
% * filename  - output dcd trajectory filename
% * trj       - trajectory [nframe x natom3 double]
% * box       - box size [nframe x 3 double]
% * title     - title characters [chars]
%
%% Example
%# natom = 3343;
%# trj = readmdcrd(natom, '4ake.trj');
%# trj(:, 1:3:end