Note that this reference documentation is identical to the help that is displayed in MATLAB when you type “help ft_channelrepair”.
FT_CHANNELREPAIR repairs bad or missing channels in the data by replacing them with the plain average of of all neighbours, by a weighted average of all neighbours, by an interpolation based on a surface Laplacian, or by spherical spline interpolating (see Perrin et al., 1989). The weighted neighbour approach cannot be used reliably to repair multiple bad channels that lie next to each other. Use as [interp] = ft_channelrepair(cfg, data) The configuration must contain cfg.method = 'weighted', 'average', 'spline' or 'slap' (default = 'weighted') cfg.badchannel = cell-array, see FT_CHANNELSELECTION for details cfg.missingchannel = cell-array, see FT_CHANNELSELECTION for details cfg.neighbours = neighbourhood structure, see also FT_PREPARE_NEIGHBOURS cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') cfg.lambda = regularisation parameter (default = 1e-5, not for method 'distance') cfg.order = order of the polynomial interpolation (default = 4, not for method 'distance') If you want to reconstruct channels that are absent in your data, those channels may also be missing from the sensor definition (grad, elec or opto) and determining the neighbours is non-trivial. In that case you must use a complete sensor definition from another dataset or from a template. The EEG, MEG or NIRS sensor positions can be present in the data or can be specified as cfg.elec = structure with electrode positions, see FT_DATATYPE_SENS cfg.elecfile = name of file containing the electrode positions, see FT_READ_SENS cfg.grad = structure with gradiometer definition, see FT_DATATYPE_SENS cfg.gradfile = name of file containing the gradiometer definition, see FT_READ_SENS cfg.opto = structure with optode definition, see FT_DATATYPE_SENS cfg.optofile = name of file containing the optode definition, see FT_READ_SENS To facilitate data-handling and distributed computing you can use cfg.inputfile = ... cfg.outputfile = ... If you specify one of these (or both) the input data will be read from a *.mat file on disk and/or the output data will be written to a *.mat file. These mat files should contain only a single variable, corresponding with the input/output structure. See also FT_MEGREALIGN, FT_MEGPLANAR, FT_PREPARE_NEIGHBOURS