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: psth.m
    path of file: ./repos/EEGapp/EEGapp/custom_stuff/Chronux/chronux_2_12/spectral_analysis/pointtimes
    
    the code of the file until where you have to start completion: function [R,t,E] = psth(data,sig,plt,T,err,t)
%  function to plot trial averaged rate smoothed by 
%  a Gaussian kernel - visual check on stationarity 
%  Usage: [R,t,E] = psth(data,sig,plt,T,err,t)
%                                                   
%  Inputs:                                  
% Note that all times have to be consistent. If data

    
function [R,t,E] = psth(data,sig,plt,T,err,t)
%  function to plot trial averaged rate smoothed by 
%  a Gaussian kernel - visual check on stationarity 
%  Usage: [R,t,E] = psth(data,sig,plt,T,err,t)
%                                                   
%  Inputs:                                  
% Note that all times have to be consistent. If data
% is in seconds, so must be sig and t. If data is in 
% samples, so must sig and t. The default is seconds.
% data            structural array of spike times   
% sig             std dev of Gaussian (default 50ms)
%                 (minus indicates adaptive with    
%                  approx width equal to mod sig)   
% plt = 'n'|'r' etc      (default 'r')              
% T is the time interval (default all)              
% err - 0 = none                                    
%       1 = Poisson                                 
%       2 = Bootstrap over trials (default)         
% (both are based on 2* std err rather than 95%)    
% t   = times to evaluate psth at                   
%                                                   
% The adaptive estimate works by first estimating   
% the psth with a fixed kernel width (-sig) it      
% then alters the kernel width so that the number   
% of spikes falling under the kernel is the same on 
% average but is time depend