[FieldTrip] Preprocessing data

Tamang, Sarita sarita.tamang at mssm.edu
Wed Aug 27 19:56:01 CEST 2014


Hello Everybody,

I'm just starting to use FieldTrip and I have some very basic questions.

I'm trying to analyze LFP data along with the spikes which is in Plexon format.

For the preprocessing part I tried to read it as continuous data so I did
clear all
close all

cfg = [];

cfg.dataset = 'fr041110a_nat1.plx'; %reading the data
data_org = ft_preprocessing(cfg);

It gave me this error with 32 u int thing

Error using timestamp_plexon (line 27)
invalid input

Error in ft_read_data (line 1064)
      ts  = timestamp_plexon(tsl, tsh); % use helper function, this returns an uint64 array

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

Error in LFP (line 8)
data_org = ft_preprocessing(cfg);


 I though this was probably due to reading it as continuous data or something I couldn't figure out so i tried using the example to see if the code runs

clear all
close all

cfg = [];

cfg.dataset = 'fr041110a_nat1.plx'; %reading the data

hdr   = ft_read_header(cfg.dataset);
event = ft_read_event(cfg.dataset);


cfg.trialfun                = 'ft_trialfun_general'; % this is the default
cfg.trialdef.eventtype      = 'Strobed'
cfg.trialdef.eventvalue     = 35; % the value of the stimulus trigger for fully incongruent (FIC).
cfg.trialdef.prestim        = 0.5; % in seconds
cfg.trialdef.poststim       = 1; % in seconds
cfg.channel    = {'AD01' 'AD03'};
cfg.continuous = 'yes';

trl = [];

for i=1:length(event)
  if strcmp(event(i).type, cfg.trialdef.eventtype)
    % it is a trigger, see whether it has the right value
    if ismember(event(i).value, cfg.trialdef.eventvalue)
      % add this to the trl definition
      begsample     = event(i).sample - cfg.trialdef.prestim*hdr.Fs;
      endsample     = event(i).sample + cfg.trialdef.poststim*hdr.Fs - 1;
      offset        = -cfg.trialdef.prestim*hdr.Fs;
      trigger       = event(i).value; % remember the trigger (=condition) for each trial
      trl(end+1, :) = [round([begsample endsample offset])  trigger];
    end
  end
end

cfg = ft_definetrial(cfg);
data_org = ft_preprocessing(cfg);

And I just used the trl loop from the example give in the website because i kept getting error saying the trial is not defined. However even after putting the code I still get the same error.

Error using ft_definetrial (line 184)
no trials were defined, see FT_DEFINETRIAL for help

I don't know what else should I try because I'm having trouble just doing the preprocessing. Your help will be very much appreciated.

Thank you,
Sarita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140827/d5a0f891/attachment-0001.html>


More information about the fieldtrip mailing list