[FieldTrip] neuralynx problem with repeated timestamps

Sebastian Michelmann SXM1085 at student.bham.ac.uk
Mon Oct 3 18:40:04 CEST 2016

Dear Fieldtrippers,
when reading Neuralynx ncs data I run into the following problem:

cfg = []; cfg.dataset = [dataset_directory filesep electrode '.ncs'];
data_nse = ft_preprocessing(cfg);

>> Index exceeds matrix dimensions.

Error in ft_read_data (line 1013)
    dat = ncs.dat(begsample:endsample);

Error in ft_preprocessing (line 576)
      dat = ft_read_data(cfg.datafile, 'header', hdr, 'begsample', begsample, 'endsample', endsample,
      'chanindx', rawindx, 'checkboundary', strcmp(cfg.continuous, 'no'), 'dataformat', cfg.dataformat);

The problem seems to be due to repeated timestamps in the data, that are corrected in @read_neuralynx_ncs line: 230

[A,I] = unique(val); % consider only the unique values
indx = indx(I);

This causes the information about the number of samples in the header and the actual samples to be different.

My question is now: How do I deal with this?  Especially since I am not entirely sure why fieldtrip handles this dataformat the way it does (e.g. sorting the timestamps at each sampling point)

So, can I just comment this out and accept the multiple sampling of some Timestamps? Or should I rather correct the information about the number of samples?
Should I even interpolate plausible Timestamps?

Any help is highly appreciated!

All the best,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20161003/e4e9577c/attachment-0001.html>

More information about the fieldtrip mailing list