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: filterAllTrack.m
    path of file: ./repos/trajectory-based-ship-classification/Code/2.filtering
    
    the code of the file until where you have to start completion: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Desarrollado por | Developed by:                     %
% University Carlos III of Madrid PhD Researchers      %
% Daniel Amigo Herrero    mailto: damigo@inf.uc3m.es   %
% David Sanchez Pedroche  mailto: davsanch@inf.uc3m.es %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Aplica el filtro IMM sobre la trayectoria completa y una configuracion concreta.
%  apply the selected estimation filter on the selected plots
function [tracks, errorInFilter] = filterAllTrack(plots, filterConf, fusionCenter, varargin)
useRMSE = false; % Se guarda el RMSE de cada traza
if length(varargin) > 0
    if strcmp(varargin{1}, "RMSE")
        useRMSE = true;
    end
end

errorInFilter = false;
tracks = cell(1, height(plots)-2);

% get the fusion center, (0,0) on px py
    
function [PkMod] = modifyPk(Pk, filterConf)
% px vx py vy pz vz
% to
% px py pz vx vy vz
PkMod = zeros(length(Pk));
PkMod(1,1) = Pk(1,1); % px
PkMod(1,2) = Pk(1,3); %
PkMod(1,3) = Pk(1,5); %
PkMod(1,4) = Pk(1,2); %
PkMod(1,5) = Pk(1,4); %
PkMod(1,6) = Pk(1,5); %
PkMod(2,1) = Pk(3,1); % py
PkMod(2,2) = Pk(3,3); %
PkMod(2,3) = Pk(3,5); %
PkMod(2,4) = Pk(3,2); %
PkMod(2,5) = Pk(3,4); %
PkMod(2,6) = Pk(3,5); %
PkMod(3,1) = Pk(5,1); % pz
PkMod(3,2) = Pk(5,3); %
PkMod(3,3) = Pk(5,5); %
PkMod(3,4) = Pk(5,2); %
PkMod(3,5) = Pk(5,4); %
PkMod(3,6) = Pk(5,5); %
PkMod(4,1) = Pk(2,1); % vx
PkMod(4,2) = Pk(2,3); %
PkMod(4,3) = Pk(2,5); %
PkMod(4,4) = Pk(2,2); %
PkMod(4,5) = Pk(2,4); %
PkMod(4,6) = Pk(2,5); %
PkMod(5,1) = Pk(4,1); % vy
PkMod(5,2) = Pk(4,3); %
PkMod(5,3) = Pk(4,5); %
PkMod(5,4) = Pk(4,2); %
PkMod(5,5) = Pk(4,4); %
PkMod(5,6) = Pk(4,5); %
PkMod(6,1) = Pk(6,1); % vz
PkMod(6,2) = Pk(6,3); %
PkMod(6,3) = Pk(6,5); %
PkMod(6,4) = Pk(6,2); %
PkMod(6,5) = Pk(6,4); %
PkMod(6,6) = Pk(6,5); %
end