documentation / example /
Examples
Here you can find example MATLAB scripts together with documentation that show specific analyses done in FieldTrip or in MATLAB. The documentation here is often not as elaborate as the tutorials, but goes more in detail into specific aspects of the data, code or analysis.
We invite you to add your own tutorials to the website, considering the documentation guidelines. Whenever you explain somebody in person or over email how to do something with FieldTrip, please consider whether you could use the website for this, allowing others to learn from it as well.
See also the tutorials and frequently asked questions.
Reading and preprocessing data
- Combine MEG with Eyelink eyetracker data
- Detect the muscle activity in an EMG channel and use that as trial definition
- Determine the filter characteristics
- Fixing a missing channel
- Getting started with reading raw EEG or MEG data
- Independent component analysis (ICA) to remove ECG artifacts
- Independent component analysis (ICA) to remove EOG artifacts
- Making your own trialfun for conditional trial definition
- Rereference EEG and iEEG data
- Use denoising source separation (DSS) to remove ECG artifacts
Sensor-level analysis
- Analyzing NIRS data recorded during listening to and repeating speech
- Analyzing NIRS data recorded during unilateral finger- and foot-tapping
- How to incorporate head movements in MEG analysis
- Interpolating data from the CTF151 to the CTF275 sensor array using megrealign
- The correct pipeline order for combining planar MEG channels
Spectral analysis
- Analysis of high-gamma band signals in human ECoG
- Analyze steady-state visual evoked potentials (SSVEPs)
- Conditional Granger causality in the frequency domain
- Cross-frequency analysis
- Effect of SNR on Coherence
- Effects of tapering for power estimates
- Fitting oscillations and one-over-F (FOOOF)
- Fourier analysis of neuronal oscillations and synchronization
- Interpolate the time axis of single-trial TFRs
- Irregular resampling auto-spectral analysis (IRASA)
- Simulate an oscillatory signal with phase resetting
Source reconstruction
- Align EEG electrode positions to BEM headmodel
- Check the quality of the anatomical coregistration
- Combined EEG and MEG source reconstruction
- Common filters in beamforming
- Compute EEG leadfields using a BEM headmodel
- Compute EEG leadfields using a concentric spheres headmodel
- Compute EEG leadfields using a FEM headmodel
- Compute forward simulated data and apply a beamformer scan
- Compute forward simulated data and apply a dipole fit
- Compute forward simulated data using ft_dipolesimulation
- Compute forward simulated data with the low-level ft_compute_leadfield
- Create a template source model aligned to MNI space
- Create atlas-based MNI-aligned grids in individual head coordinates
- Create MNI-aligned grids in individual head coordinates
- Fit a dipole to the tactile ERF after mechanical stimulation
- Fitting a template MRI to the MEG Polhemus head shape
- How to create a head model if you do not have an individual MRI
- Localizing the sources underlying the difference in event-related fields
- Make MEG leadfields using different headmodels
- Read Neuromag .fif mri and create a MNI-aligned single-shell head model
- Symmetric dipole pairs for beamforming
- Testing BEM created EEG lead fields
- Use an MNI-aligned grid with a FEM headmodel in individual head coordinates
- Use your own forward leadfield model in an inverse beamformer computation
Statistical analysis
- Apply non-parametric statistics with clustering on TFRs of power that were computed with BESA
- Computing and reporting the effect size
- Defining electrodes as neighbours for cluster-level statistics
- Source statistics
- Stratify the distribution of one variable that differs in two conditions
- Use simulated ERPs to explore cluster statistics
- Using general linear modeling on time series data
- Using general linear modeling over trials
- Using general linear modeling to analyze NIRS timeseries data
- Using simulations to estimate the sample size for cluster-based permutation test
- Using threshold-free cluster enhancement for cluster statistics
Real-time analysis
- Example real-time average
- Example real-time classification
- Example real-time power estimate
- Example real-time selective average
- Example real-time signal viewer
- Measuring the timing delay and jitter for a real-time application
- Realtime neurofeedback application based on Hilbert phase estimation
Plotting and visualization
- Creating a layout for plotting NIRS optodes and channels
- Making a synchronous movie of EEG or NIRS combined with video recordings
- Plotting the result of source reconstruction on a cortical mesh
Various other examples
- BIDS - the brain imaging data structure
- Combining simultaneous recordings in BIDS
- Converting an example audio dataset for sharing in BIDS
- Converting an example behavioral dataset for sharing in BIDS
- Converting an example EEG dataset for sharing in BIDS
- Converting an example EMG dataset for sharing in BIDS
- Converting an example eyetracker dataset for sharing in BIDS
- Converting an example MEG dataset for sharing in BIDS
- Converting an example motion tracking dataset for sharing in BIDS
- Converting an example NIRS dataset for sharing in BIDS
- Converting an example video dataset for sharing in BIDS
- Converting the combined MEG/fMRI MOUS dataset for sharing in BIDS
- Correlation analysis of fMRI data
- Example analysis pipeline for BioSemi data
- Find the orientation of planar gradiometers
- How to import data from MNE-Python and FreeSurfer
- How to use ft_checkconfig
- Making your analysis pipeline reproducible using reproducescript
- Perform modified multiscale entropy (mMSE) analysis on EEG/MEG/LFP data
- Using reproducescript for a group analysis
- Using reproducescript on a full study