Note that this reference documentation is identical to the help that is displayed in MATLAB when you type “help ft_denoise_pca”.

  FT_DENOISE_PCA performs a principal component analysis (PCA) on specified reference
  channels and subtracts the projection of the data of interest onto this orthogonal
  basis from the data of interest. This is the algorithm which is applied by 4D to
  compute noise cancellation weights on a dataset of interest. This function has been
  designed for 4D MEG data, but can also be applied to data from other MEG systems.
  Use as
    [dataout] = ft_denoise_pca(cfg, data)
  or as
    [dataout] = ft_denoise_pca(cfg, data, refdata)
  where "data" is a raw data structure that was obtained with FT_PREPROCESSING. If
  you specify the additional input "refdata", the specified reference channels for
  the regression will be taken from this second data structure. This can be useful
  when reference-channel specific preprocessing needs to be done (e.g. low-pass
  The output structure dataout contains the denoised data in a format that is
  consistent with the output of FT_PREPROCESSING.
  The configuration should contain
    cfg.refchannel = the channels used as reference signal (default = 'MEGREF')    = the channels to be denoised (default = 'MEG')
    cfg.truncate   = optional truncation of the singular value spectrum (default = 'no')
    cfg.zscore     = standardise reference data prior to PCA (default = 'no')
    cfg.pertrial   = 'no' (default) or 'yes'. Regress out the references on a per trial basis
    cfg.trials     = list of trials that are used (default = 'all')
    cfg.updatesens = 'no' or 'yes' (default = 'yes')
  if cfg.truncate is integer n > 1, n will be the number of singular values kept.
  if 0 < cfg.truncate < 1, the singular value spectrum will be thresholded at the
  fraction cfg.truncate of the largest singular value.