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
Note Filter Example
Import streaming EEG data into Matlab using TDTbin2mat
Filter around behavioral events that were timestamped by the user using the Run-time Notes feature in Synapse
Plot each occurrence in a subplot organized by Note type
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
Filter and Threshold Raw Data Into Snippets
Import raw streaming data into Matlab using TDTbin2mat
Digitally filter the single unit data using TDTdigitalfilter
Threshold and extract snippets using TDTthresh
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
This example goes through fiber photometry analysis using techniques
such as data smoothing, bleach detrending, and z-score analysis.
The epoch averaging was done using TDTfilter.

Author Contributions:
TDT, David Root, and the Morales Lab contributed to the writing and/or conceptualization of the code.
The signal processing pipeline was inspired by the workflow developed by David Barker et al. (2017) for the Morales Lab.
The data used in the example were provided by David Root.

Author Information:
David H. Root
Assistant Professor
Department of Psychology & Neuroscience
University of Colorado, Boulder
Lab Website:

About the authors:
The Root lab and Morales lab investigate the neurobiology of reward, aversion, addiction, and depression.

TDT edits all user submissions in coordination with the contributing author(s) prior to publishing.
Licking Bout Epoc Filtering
This example looks at fiber photometry data in the VTA where subjects are provided sucrose water after a fasting period. Lick events are captured as TTL pulses. Objective is to combine many consecutive licking events into a single event based on time difference and lick count thresholds. New lick bout events can then be used for clear peri-event filtering.

Export to Other Formats

Export Continuous Data To Binary File
Import continuous data into Matlab using TDTbin2mat
Export the to a binary file (f32 floating point or 16-bit integer)
Channels are interlaced in the final output file
Good for exporting to other data analysis applications

© 1987-2019 TDT.  All Rights Reserved.

Tucker-Davis Technologies | New Frontiers in Neuroscience