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: convert_event.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/private
    
    the code of the file until where you have to start completion: function [obj] = convert_event(obj, target, varargin)

% CONVERT_EVENT converts between the different representations of events, 
% which can be
%   1) event structure, see FT_READ_EVENT
%   2) matrix representation as in trl (Nx3), see FT_DEFINETRIAL
%   3) matrix representation as in artifact 
    
function event = artifact2event(artifact, typenames)
% ARTIFACT2EVENT makes event structure from artifact definition (or cell
% array of artifact definitions). event.type is always 'artifact', but
% incase of cellarays of artifacts is is also possible to hand 'typenames'
% with length(artifact)

if ~iscell(artifact)
  artifact = {artifact};
end