Offline Analysis Examples

TDT Matlab Examples

These examples assume you downloaded our example data sets and extracted them into the \TDTMatlabSDK\Examples\ directory.

Averaging Example
Import stream and epoc data into Matlab using TDTbin2mat
Plot the average waveform around the epoc event
Good for Evoked Potential detection
LFP Plot Example
Import streaming LFP data into Matlab using TDTbin2mat
Plot the power spectrum and RMS of the waveform
Good for sleep scoring and behavioral discrimination
Raster Peristimulus Time Histogram (PSTH) Example
Import snippet and epoc data into Matlab using TDTbin2mat
Generate peristimulus raster and histogram plots over all trials
Good for stim-response experiments, such as optogenetic or electrical stimulation
Snippet Plot Example
Import snippet data into Matlab using TDTbin2mat
Sort snippets based on channel number and sort code for any number of channels and sort codes
Plot the average waveform shape and standard deviation for 16 channels and three sort codes
Good for spike sorting and first-pass visualization of sorted waveforms
Stream Plot Example
Import continuous data into Matlab using TDTbin2mat
Plot a single channel of data with various filtering schemes
Good for first-pass visualization of streamed data

TDT Community Examples

We think that cultivating a strong and open community of TDT users is essential for maximizing research efficiency. The cross-pollination of ideas and methods across labs, especially those with similar research interests and using the same equipment, makes the science more rigorous overall. As such, we would like YOU to consider contributing to the TDT community with an example analysis and workbook, like the ones at the top of this page.


You can submit your examples to TDT by emailing Include your name, lab information, research interests, matlab script, and a link to the block of data used in the analysis. Accepted submissions will be featured on this webpage, along with a description of the analysis and a bio of the submitting researcher. We hope that this exposure will help our users learn more about what great research others in the TDT community are doing!

Fiber Photometry Epoch Averaging Example
Contributing Author: David H. Root
Assistant Professor
Department of Psychology & Neuroscience
University of Colorado, Boulder
Lab Website:

This example goes through fiber photometry analysis using similar methods to Barker et al., 2017 (DOI).
This includes bleach detrending and z-score analysis.
The epoch averaging was done using TDTfilter.

About the author:
The Root lab investigates the neurobiology of reward, aversion, addiction, and depression.

TDT edits all user submissions in coordination with the contributing author prior to publishing.

© 1987-2018 TDT.  All Rights Reserved.

Tucker-Davis Technologies | New Frontiers in Neuroscience