<div dir="ltr"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">Dear Tineke, </span><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px"><br></span></font></div><div><span style="font-size:13.3333px;color:rgb(0,0,0);font-family:Helvetica">I have created a function that performs timelock analysis on trials present in Dat which is obtained from Data of a subject.</span><br></div><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px"><br></span></font></div><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px">Script Average calls the function:</span></font></div><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px"><br></span></font></div><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px"><div style="">Sub                         = 'Subject1'; % Need to perform for all the subjects</div><div style="">load(['MTT_EP_data_',Sub,'.mat']);</div><div style=""><br></div><div style="">[ep] = Actual_Timelockanalysis_MTT_EP(Data) </div><div style=""><br></div><div style=""><br></div></span></font></div><div><font color="#000000" face="Helvetica"><div style=""><span style="font-size:13.3333px">function [EP] = Actual_Timelockanalysis_MTT_EP(Data)</span></div><div style=""><span style="font-size:13.3333px"><br></span></div><div style=""><span style="font-size:13.3333px">cfg = [];</span></div><div style=""><span style="font-size:13.3333px">cfg.channels = {'Cz';'M1';'M2'};</span></div><div style=""><span style="font-size:13.3333px"><br></span></div><div style=""><span style="font-size:13.3333px">for i = 1; % Only for NOP=1</span></div><div style=""><span style="font-size:13.3333px">    S = unique(Data(i).Stimuli); % To find the unique stimuli</span></div><div style=""><span style="font-size:13.3333px">          for j = 1:length(S)</span></div><div style=""><span style="font-size:13.3333px">                  Indices = find(Data(i).Stimuli == S(j)); % comparison</span></div><div style=""><span style="font-size:13.3333px">                  Idx{1} = 1:length(Indices); % Trials per amplitude, both perceived and not perceived</span></div><div style=""><span style="font-size:13.3333px">                  for k = 1;</span></div><div style=""><span style="font-size:13.3333px">                    Dat(i,j,k).Stimuli = S(j); % Corresponding unique stimuli</span></div><div style=""><span style="font-size:13.3333px">                    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</span></div><div style=""><span style="font-size:13.3333px">                    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)</span></div><div style=""><span style="font-size:13.3333px">                    Dat(i,j,k).fsample = Data(i).fsample;</span></div><div style=""><span style="font-size:13.3333px">                    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 </span></div><div style=""><span style="font-size:13.3333px">                    </span></div><div style=""><span style="font-size:13.3333px">                    if ~isempty(Idx{1})</span></div><div style=""><span style="font-size:13.3333px">                        EP{i,j}.All = ft_timelockanalysis(cfg,Dat(i,j));</span></div><div style=""><span style="font-size:13.3333px">                    else</span></div><div style=""><span style="font-size:13.3333px">                        EP{i,j} = [];</span></div><div style=""><span style="font-size:13.3333px">                        </span></div><div style=""><span style="font-size:13.3333px">                    end</span></div><div style=""><span style="font-size:13.3333px">                    end</span></div><div style=""><span style="font-size:13.3333px">                end</span></div><div style=""><span style="font-size:13.3333px">          end </span></div></font><br><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">Dat is supposed to be a 1x10 (because there are 10 unique stimuli) structure with 5 fields which are:</span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">1. Type of stimuli</span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">2. Number of trials for the respective stimuli (64x4000 double for each trial)</span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">3. Time of the trials (1x4000 double which is the same for every trial)</span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">4. fsample (1000) </span></div><div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:13.3333px">5. Labels of the EEG (64 channels). </span></div><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px"><br></span></font></div><div><font color="#000000" face="Helvetica"><span style="font-size:13.3333px">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. <br></span></font><br><div class=""><font color="#999999" class="">Sent with <a href="https://mailtrack.io/install?source=signature&lang=en&referral=s.borbaruah@student.utwente.nl&idSignature=22" class="">MailTrack</a></font></div></div><img width="0" height="0" class="mailtrack-img" src="https://mailtrack.io/trace/mail/ac998faad9cbaa5f76098f375bf0559a0b6cc02a741513.png"></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 10:34 AM, Snijders, T.M. (Tineke) <span dir="ltr"><<a href="mailto:tineke.snijders@donders.ru.nl" target="_blank">tineke.snijders@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Helvetica;color:#000000;font-size:10pt">
Dear Soujata,<br>
<br>
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.<br>
<br>
Best,<br>
Tineke<br>
<br>
<br>
<br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" size="2" face="Tahoma"><b>From:</b> <a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a> [<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a>] on behalf of Soujata Borbaruah [<a href="mailto:s.borbaruah@student.utwente.nl" target="_blank">s.borbaruah@student.utwente.nl</a>]<br>
<b>Sent:</b> Tuesday, May 10, 2016 10:00 AM<br>
<b>To:</b> fieldtrip, donders<br>
<b>Subject:</b> [FieldTrip] Function is asking for raw data as input<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr">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: 
<div><br>
</div>
<div>
<div>Error using ft_checkdata (line 464)</div>
<div>This function requires raw+comp or raw data as input.</div>
<div><br>
</div>
<div>Error in ft_timelockanalysis (line 106)</div>
<div>data = ft_checkdata(data, 'datatype', {'raw+comp', 'raw'}, 'feedback', 'yes', 'hassampleinfo', 'yes');</div>
<div><br>
</div>
<div>Error in Actual_Timelockanalysis_MTT_EP (line 20)</div>
<div>                        EP{i,j,k}.All = ft_timelockanalysis(cfg,Dat(i,j,k));</div>
<div><br>
</div>
<div>Error in Noise_MTT_EP (line 8)</div>
<div>[ep] = Actual_Timelockanalysis_MTT_EP(Data)</div>
<div> </div>
<div>Please let me know if you require any more information. </div>
<br>
<br>
<br>
<div><font color="#999999">Sent with <a href="https://mailtrack.io/install?source=signature&lang=en&referral=s.borbaruah@student.utwente.nl&idSignature=22" target="_blank">
MailTrack</a></font></div>
</div>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" height="0" width="0"></div>
</div>
</div></div></div>
</div>
</div>

<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>