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: read_neurosim_spikes.m
    path of file: ./repos/spm/external/fieldtrip/fileio/private
    
    the code of the file until where you have to start completion: function [spike] = read_neurosim_spikes(filename,headerOnly)

% READ_NEUROSIM_SPIKES reads the "spikes" file that is written by Jan
% van der Eerden's NeuroSim software.  The output is represented in a
% structure that is consistent with the FieldTrip spike representation.
%
% OUTPUT
% spike: A FieldTrip raw spike structu
    
function output is just the header.
    spike.hdr.label=label;
    spike=spike.hdr;
else

% data is loaded; now put it in a structure that FieldTrip can use.
% every neuron is considered to have its own channel (identified by its
% neuron number).

spike.label=cell(1,numel(label));
spike.timestamp=cell(1,numel(label));


for n=1:numel(label)
    % write labels ([number]: [neuron type] in [network])
    spike.label{n}=strrep(label{n},'neuron ','');
    % select spike times belonging to the neuron
    sel=dat{2}==n;
    spike.timestamp{n}=dat{1}(sel)';
end