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: pspm_interpolate.m
    path of file: ./repos/PsPM/src
    
    the code of the file until where you have to start completion: function [sts, outdata] = pspm_interpolate(varargin)
% ● Description
%   pspm_interpolate interpolates NaN values passed with the indata parameter.
%   The behaviour of the function can furthermore be adjusted with the
%   combination of different options.
%   The function works either on single data sets such as a filename, a
%   numeric array or a pspm data struct. Alternatively it is possible to pass
%   a cell containing all these possible datatypes. The function then
%   iterates through the whole data set and replaces the passed data with the
%   interpolated data. For filenames the interpolated data will, depending on
%   option.newfile, be written to the existing file or can also be added to a
%   new file with filename 'i'+<old filename>. The corresponding cell
%   (in outdata) will then contain the filename of the new file
%   (if newfile = 1) or will contain the channel id where the interpolated
%   data can be found in the existing file (because it has been added or
%   replaced)
    
function then tries to
%   │               interpolate all continuous data channels. This
%   │               works only on files or structs.
%   │               [optional; default: empty]
%   ├.channel_action:
%   │               Defines whether the interpolated data should be added
%   │               or the corresponding channel should be replaced.
%   │               [optional; accept: 'add', 'replace'; default: 'add']
%   └────.newfile:  This is only possible if data is loaded from a file.
%                   If 0 the data will be added to the file where
%                   the data was loaded from. If 1 the data will be
%                   written to a new file called 'i'+<old filename>.
%                   [optional; default: 0]
% ● Output
%             sts:  Returns the status of the function
%                   -1: function did not work properly
%                    1: the function went through properly
%         outdata:  Has the same format as indata but contains the interpolated
%                   data (or the filename(s) where the interpolated data can be
%                   found).
% ● History
%   Introduced in PsPM 3.0
%   Written in 2015 by Tobias Moser (University of Zurich)
%   Maintained in 2022 by Teddy Chao (UCL)

%% 1 Initialise
global settings
if isempty(settings)
  pspm_init;
end
outdata = {}; % will return a cell of the same size as the indata
sts = -1;
switch length(varargin)
  case 1
    indata = varargin{1};
    options = struct();
  case 2
    indata = varargin{1};
    options = varargin{2};
  case 3
    warning('Up to two variables are accepted by pspm_interpolate.');
    return
end