# wiki

### Sidebar

Reference

Training

Beyond the lab

analysis:neuralynx

To load *.Ncs (Neuralynx Continuously Sampled, sometimes also referred to as CSC for Continuously Sampled Channel) files in MATLAB, use the following:

fc = FindFiles('*.ncs');
data = ft_read_neuralynx_interp(fc);

This will create a fieldtrip data structure with all CSCs, filling any gaps in the original data with NaNs.

Note that ft_read_neuralynx_interp calls a custom version of ft_read_data (i.e. not the version included in the official fieldtrip releases). Make sure you use an up to date version available from the vandermeerlab code repository (see also the Computing page on how to use this).

# Neuralynx CSC data properties

Neuralynx CSC data is generally stored in blocks of 512 samples. Each block has a timestamp (unsigned 64-bit integer on our Digital Lynx) corresponding to the start of the block. Not all blocks have all 512 samples; how many samples are good is also indicated for each block. Based on the overall sampling rate for the file, the block timestamps, and the number of valid samples, a raw tsd can be constructed. Note however that because the time difference within blocks and between blocks may not be the same, and because Neuralynx allows recording to be paused, the resulting raw data will not have a perfectly constant sampling rate. Many analyses require a constant sampling rate, and some sort of interpolation or correction is therefore required. ft_read_neuralynx_interp implements a version of this.