[FieldTrip] Function is asking for raw data as input

Snijders, T.M. (Tineke) tineke.snijders at donders.ru.nl
Tue May 10 17:38:06 CEST 2016


Hi Soujata,

This probably happens because matlab is case-sensitive.
So use .label instead of .Label; .trial instead of .Trial; .time instead of .Time.
Then fieldtrip will recognize the correct fields.

Best,
Tineke

________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Soujata Borbaruah [s.borbaruah at student.utwente.nl]
Sent: Tuesday, May 10, 2016 11:27 AM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] Function is asking for raw data as input

Dear Tineke,

I have created a function that performs timelock analysis on trials present in Dat which is obtained from Data of a subject.

Script Average calls the function:

Sub                         = 'Subject1'; % Need to perform for all the subjects
load(['MTT_EP_data_',Sub,'.mat']);

[ep] = Actual_Timelockanalysis_MTT_EP(Data)


function [EP] = Actual_Timelockanalysis_MTT_EP(Data)

cfg = [];
cfg.channels = {'Cz';'M1';'M2'};

for i = 1; % Only for NOP=1
    S = unique(Data(i).Stimuli); % To find the unique stimuli
          for j = 1:length(S)
                  Indices = find(Data(i).Stimuli == S(j)); % comparison
                  Idx{1} = 1:length(Indices); % Trials per amplitude, both perceived and not perceived
                  for k = 1;
                    Dat(i,j,k).Stimuli = S(j); % Corresponding unique stimuli
                    Dat(i,j,k).Trial = Data(i).Trials(Indices(Idx{k})); % Extract the trials from Data(1).Trials and place in the new Dat structure
                    Dat(i,j,k).Time = repmat({Data(i).TrialTime}, [1 length(Idx{k})]); %represents 1 trial as a whole (9th trial took that much of time)
                    Dat(i,j,k).fsample = Data(i).fsample;
                    Dat(i,j,k).Label = Data(i).EEGlabels; % Contains all the 64 channels and the selection of the channels can be done using cfg.channels

                    if ~isempty(Idx{1})
                        EP{i,j}.All = ft_timelockanalysis(cfg,Dat(i,j));
                    else
                        EP{i,j} = [];

                    end
                    end
                end
          end

Dat is supposed to be a 1x10 (because there are 10 unique stimuli) structure with 5 fields which are:
1. Type of stimuli
2. Number of trials for the respective stimuli (64x4000 double for each trial)
3. Time of the trials (1x4000 double which is the same for every trial)
4. fsample (1000)
5. Labels of the EEG (64 channels).

The Dat structure is created, however when the data in it is called for timelockanalysis, it fails and the warning says it is not raw data.

Sent with MailTrack<https://mailtrack.io/install?source=signature&lang=en&referral=s.borbaruah@student.utwente.nl&idSignature=22>


On Tue, May 10, 2016 at 10:34 AM, Snijders, T.M. (Tineke) <tineke.snijders at donders.ru.nl<mailto:tineke.snijders at donders.ru.nl>> wrote:
Dear Soujata,

Have you checked what data is in Dat(i,j,k)? The data input of ft_timelockanalysis should be organised in a structure as obtained from ft_preprocessing, with trial-based data.

Best,
Tineke



________________________________
From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of Soujata Borbaruah [s.borbaruah at student.utwente.nl<mailto:s.borbaruah at student.utwente.nl>]
Sent: Tuesday, May 10, 2016 10:00 AM
To: fieldtrip, donders
Subject: [FieldTrip] Function is asking for raw data as input

Hello, I am working on statistical analysis of EEG data from subjects. I am trying to perform time lock analysis on the data available but while executing the script these are the following errors I get:

Error using ft_checkdata (line 464)
This function requires raw+comp or raw data as input.

Error in ft_timelockanalysis (line 106)
data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes');

Error in Actual_Timelockanalysis_MTT_EP (line 20)
                        EP{i,j,k}.All = ft_timelockanalysis(cfg,Dat(i,j,k));

Error in Noise_MTT_EP (line 8)
[ep] = Actual_Timelockanalysis_MTT_EP(Data)

Please let me know if you require any more information.



Sent with MailTrack<https://mailtrack.io/install?source=signature&lang=en&referral=s.borbaruah@student.utwente.nl&idSignature=22>

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160510/bf9a04ec/attachment-0002.html>


More information about the fieldtrip mailing list