# What are the MATLAB and external requirements?

## MATLAB version

We try to develop FieldTrip in such a way that it works with the latest MATLAB release on the most popular operating system platforms, but at the same time we try to have it work with as many older MATLAB versions as possible.

However, the MATLAB syntax and the availability of functions in the standard MathWorks toolboxes changes over time. Consequently, sometimes we will use MATLAB code that is only supported from a certain version upwards. In general we attempt to support MATLAB versions up to 5 years old.

An online poll in April 2011 showed that a large proportion (>98%) of our users access the FieldTrip toolbox with a MATLAB version younger than 2006 (<5 years). The full results can be found here.

## MathWorks toolboxes

MATLAB includes a large number of functions in standard toolboxes that come with every installation, but certain functions are included in additional (commercial) toolboxes from MathWorks, such as the Signal Processing or the Statistics toolbox. Whether you need to buy these toolboxes depends on whether you want to use specific functionality in FieldTrip. We try to avoid using these additional MathWorks toolboxes to the extent that we will look for alternatives (e.g., from GNU Octave) or use drop-in replacement functions for certain functions, as long as the time required to implement these alternatives is not too large.

The following functions depend on the MathWorks Image Processing Toolbox (images)

- ft_sourceplot
- ft_volumesegment
- ft_read_mri

The following functions depend on the MathWorks Optimization Toolbox (optim)

- warp_optim
- dipole_fit

The following functions depend on the MathWorks Signal Processing Toolbox (signal)

- ft_mvaranalysis
- ft_resampledata
- ft_preproc_bandpassfilter
- ft_preproc_bandstopfilter
- ft_preproc_denoise
- ft_preproc_highpassfilter
- ft_preproc_hilbert
- ft_preproc_lowpassfilter
- ft_preproc_medianfilter
- ft_preproc_resample
- ft_specest_hilbert
- ft_specest_mtmconvol
- ft_specest_mtmfft
- ft_spiketriggeredspectrum_convol
- ft_spiketriggeredspectrum_fft

The following functions depend on the MathWorks Statistics and Machine Learning Toolbox (stats)

- ft_connectivitysimulation
- ft_headmovement
- ft_regressconfound
- ft_sourcedescriptives
- ft_statistics_stats
- ft_stratify
- ft_datatype_spike
- ft_statfun_depsamplesFmultivariate
- ft_statfun_indepsamplesF
- ft_statfun_indepsamplesZcoh
- ft_spike_isi
- ft_spike_plot_isi
- ft_spike_plot_isireturn
- ft_spike_plot_jpsth
- ft_spike_plot_raster
- ft_spike_waveform
- ft_spike_xcorr
- ft_spikesorting
- ft_spiketriggeredspectrum_convol

## External requirements

### Free toolboxes

Besides the non-free MathWorks toolboxes that are used by some functions, FieldTrip also makes use of other free toolboxes for certain functionality, such as access to specific file formats. Using these external toolboxes allows us to focus on specifically improving FieldTrip and to join forces with other open source software projects. Whether you need these non-commercial external toolboxes depends on the data formats that you will use and whether you want to use their specific functionality. Most of these are also developed as open source projects and they all can be downloaded from the internet. Some of them are not open source, but can be redistributed in compiled form (e.g., mex files, p-files, compiled binaries). There are also certain toolboxes that FieldTrip functions can use, but which have even more strict copyright restrictions attached (e.g., signing a Non-Disclosure Agreement) and hence we are not able to redistribute.

A number of external toolboxes is included in the `fieldtrip/external`

subdirectory. These include

- afni to read AFNI data
- artinis to read Artinis fNIRS data
- bayesFactor
- bci2000 to read BCI200 data
- bct
- bemcp for forward EEG modeling using BEM
- besa to read BESA data
- biosig to read various EEG file formats
- brainstorm
- brewermap
- bsmart
- cca
- cmocean
- comm
- ctf to read CTF data
- dipoli for forward EEG modeling using BEM
- dss
- duneuro
- eeglab for independent component analysis
- eeprobe to read ANT-Neuro data
- egi_mff_v2
- ezc3d
- fastica for independent component analysis
- fileexchange varous functions from Mathworks File Exchange
- fns
- freesurfer to read MRI data
- gcmi
- gifti
- gtec
- homer3 to read fNIRS data
- ibtb
- icasso
- iso2mesh for operations on triangulated surface meshes
- itab
- jsonlab
- lagextraction
- mars
- matplotlib
- mffmatlabio to read EGI data
- mne to read Neuromag/Elekta/MEGIN data
- mrtrix
- netcdf
- neurone
- neuroscope
- neuroshare
- npmk
- openmeeg for BEM head modeling
- plot2svg
- ricoh_meg_reader to read data from the Ricoh MEG system
- simbio for forward EEG modeling using FEM
- spm12, spm8 and spm2 to read some MRI formats, for spatial normalization and segmentation
- sqdproject
- vgrid
- videomeg
- wavefront
- xdf
- xml4mat
- yokogawa to read data from the Yokogawa MEG system
- yokogawa_meg_reader to read data from the Yokogawa MEG system

Although we distribute these toolboxes along with FieldTrip to facilitate their use, we do not develop or support these ourselves. Each of the corresponding toolboxes has its own license agreement, and in the corresponding directories you can find more information on who is responsible for their maintenance and support.

### Optional toolboxes

The following toolboxes are also used for specific computations, but are not included in the default FieldTrip release. You can download them separately and place them in the `fieldtrip/external`

directory (where they will be automatically found) or anywhere else on your path.

- nlxnetcom
- meg-pd
- meg-calc
- tcp_udp_ip

## Replacements for functions from MathWorks toolboxes

To avoid unnecessary dependencies on functions from non-standard MathWorks toolboxes, FieldTrip includes a number of drop-in replacement functions that have the same functionality as their MATLAB counterparts. Have a look at this FAQ how you can control whether these are added to your path.

Alternatives are provided for the following functions from the MathWorks Statistics Toolbox (stats)

- nansum, nanstd, etc.
- betacdf
- betainv
- betapdf
- binocdf
- binopdf
- mvnrnd
- tcdf
- tinv
- range

Alternatives are provided for the following functions from the MathWorks Signal Processing Toolbox (signal)

- barthannwin
- bilinear
- blackmanharris
- bohmanwin
- boxcar
- butter
- downsample
- filtfilt
- fir1
- fir2
- firls
- flattopwin
- gausswin
- hann
- hanning
- hilbert
- kaiser
- nuttallwin
- parzenwin
- rectwin
- resample
- triang
- tukeywin
- upfirdn
- upsample
- window

Alternatives are provided for the following functions from the MathWorks Image Processing Toolbox (images)

- rgb2hsv