<div dir="ltr">Dear Tineke,<div><br></div><div>Many many thanks for the suggestion. It works now, however, instead of averaging trials in the three channels that is listed in cfg.channel, the script is performing the averaging in all 64 channels. Is it possible to correct it? </div><div><br></div><div>After the script is executed, cfg contains a cell called channels with 6x1 cell and another cell called channel with 64x1 cell. I think the script is taking the data from channel. </div><div><br></div><div>Regards, </div><div>Soujata<br><br><br><br><div class="mt-signature"><font color="#999999" class="mt-signature-text">Sent with <a href="https://mailtrack.io/install?source=signature&lang=en&referral=s.borbaruah@student.utwente.nl&idSignature=22" class="mt-install">MailTrack</a></font></div></div><img width="0" height="0" class="mailtrack-img" src="https://mailtrack.io/trace/mail/08cae58edd41534eacdbbab3bfed34f6fcb25b40741513.png"></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 11:27 AM, Soujata Borbaruah <span dir="ltr"><<a href="mailto:s.borbaruah@student.utwente.nl" target="_blank">s.borbaruah@student.utwente.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>Sub                         = 'Subject1'; % Need to perform for all the subjects</div><div>load(['MTT_EP_data_',Sub,'.mat']);</div><div><br></div><div>[ep] = Actual_Timelockanalysis_MTT_EP(Data) </div><div><br></div><div><br></div></span></font></div><div><font color="#000000" face="Helvetica"><div><span style="font-size:13.3333px">function [EP] = Actual_Timelockanalysis_MTT_EP(Data)</span></div><div><span style="font-size:13.3333px"><br></span></div><div><span style="font-size:13.3333px">cfg = [];</span></div><div><span style="font-size:13.3333px">cfg.channels = {'Cz';'M1';'M2'};</span></div><div><span style="font-size:13.3333px"><br></span></div><div><span style="font-size:13.3333px">for i = 1; % Only for NOP=1</span></div><div><span style="font-size:13.3333px">    S = unique(Data(i).Stimuli); % To find the unique stimuli</span></div><div><span style="font-size:13.3333px">          for j = 1:length(S)</span></div><div><span style="font-size:13.3333px">                  Indices = find(Data(i).Stimuli == S(j)); % comparison</span></div><div><span style="font-size:13.3333px">                  Idx{1} = 1:length(Indices); % Trials per amplitude, both perceived and not perceived</span></div><div><span style="font-size:13.3333px">                  for k = 1;</span></div><div><span style="font-size:13.3333px">                    Dat(i,j,k).Stimuli = S(j); % Corresponding unique stimuli</span></div><div><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><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><span style="font-size:13.3333px">                    Dat(i,j,k).fsample = Data(i).fsample;</span></div><div><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><span style="font-size:13.3333px">                    </span></div><div><span style="font-size:13.3333px">                    if ~isempty(Idx{1})</span></div><div><span style="font-size:13.3333px">                        EP{i,j}.All = ft_timelockanalysis(cfg,Dat(i,j));</span></div><div><span style="font-size:13.3333px">                    else</span></div><div><span style="font-size:13.3333px">                        EP{i,j} = [];</span></div><div><span style="font-size:13.3333px">                        </span></div><div><span style="font-size:13.3333px">                    end</span></div><div><span style="font-size:13.3333px">                    end</span></div><div><span style="font-size:13.3333px">                end</span></div><div><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><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 width="0" height="0" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">




<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>
<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 height="0" width="0"></div>
</div>
</div></div></div>
</div>
</div>

<br></div></div>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">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>
</blockquote></div><br></div>