<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Irene,<div class=""><br class=""></div><div class="">what is the reason to use the extra checkdata step?</div><div class="">The function checks if the input data has the correct „datatype“ field.</div><div class="">Since you probably don’t have that field, the function will throw an error.</div><div class=""><br class=""></div><div class="">Also, I’d recommend using the eeglab2fieldtrip-function to get from EEGlab .set to a fieldtrip-like structure.</div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">Julian</div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 04.01.2019 um 12:47 schrieb Irene Varela Leniz <<a href="mailto:irene.varela@alumni.mondragon.edu" class="">irene.varela@alumni.mondragon.edu</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi, </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I am a researcher in Mondragon University working on source reconstruction of EEG data. I am new at fieldtrip and I feel a little bit lost about this software. I have some errors in a code I have developed but I do not manage to solve them. Could you please help me?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I want to plot EEG data of a channel called 'A1' which is the first row in a 2D matrix variable called data, which is inside EEG structure. The code I have developed is below and I get the following error: </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><i class=""><br class=""></i></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><i class="">Error using ft_checkdata (line 525)</i></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><i class="">This function requires 'timelock' or 'freq' data as input, see ft_datatype_timelock or ft_datatype_freq.</i></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><i class=""><br class=""></i></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">The code is the following:</div><div class="gmail_default"><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">clc; clear all; close all;</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">clear variables</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">restoredefaultpath; % set a clean path</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">main='E:\';</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">cd='E:\fieldtrip-20181217'; % change this</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">addpath(cd);</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class=""><br class=""></i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">ft_defaults;</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">filename = "E:\PBLdata\O200_RS1_final.set"; %cambiar aqui y poner vuestro directorio</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">load(filename, '-mat'); %Create EEG struct</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">location = EEG.chanlocs;</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">data = EEG.data; </i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class=""><br class=""></i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">cfg = [];</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">cfg.xlim = [-0.2 1.0];</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">cfg.ylim = [-1e-13 3e-13];</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">cfg.channel = 'A1';</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">datos = data(1,:);</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">Ndata = numel(datos);</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">for i=1:Ndata</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class=""> % check if the input data is valid for this function</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class=""> datos(i) = ft_checkdata(datos(i), 'datatype', {'timelock', 'freq'});</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">end</i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class=""><br class=""></i></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" class=""><i class="">figure; ft_singleplotER(cfg,datos);</i></font></div></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><i class=""> </i></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thank you in advance,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Irene</div><div class="gmail_default"><br class=""></div></div></div></div></div>
_______________________________________________<br class="">fieldtrip mailing list<br class=""><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">https://doi.org/10.1371/journal.pcbi.1002202<br class=""></div></blockquote></div><br class=""></div></body></html>