<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><span style="font-size: 12pt;"> </span><br>
</p>
<div style="color: rgb(0, 0, 0);">
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="">
<p style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
<span id="ms-rterangepaste-start"></span></p>
<div id="x_divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
<p><span style="color:rgb(36,41,46); font-size:14px">Hello everyone,<br>
I am trying to use </span><span style="font-weight:600; color:rgb(36,41,46); font-size:14px">ft_qualitycheck</span><span style="color:rgb(36,41,46); font-size:14px"> for my MEG data. However, it always gives me the warning saying it could not determine the
 file type of my subject.hist file. It further gives me, I think, an incomplete analysis picture. Further I get the warning: Error updating legend not enough input arguments as well as the warning: tiralfun not specified using ft_trialfun_general. <br>
</span></p>
<p><span style="color:rgb(36,41,46); font-size:14px"><br>
</span></p>
<p>In short:<br>
<br>
- no error message<br>
<br>
- multiple warnings: <br>
</p>
<ul style="margin-bottom:0px; margin-top:0px">
<li>couldn't determine file type (regarding the subject.hist file)<br>
</li><li>error updating legend not enough input arguments</li><li>trialfun not specified using  ft_trialfun_general</li></ul>
<div><br>
</div>
<div>- The image created by ft_qualitycheck: added in the attachments</div>
<br>
- System info:<br>
<ul style="margin-bottom:0px; margin-top:0px">
<li>operating system: linux (in a (vnc) server system)<br>
</li><li>matlab version: I tried 2019a,2018b and 2011b<br>
</li><li>fieldtrip version:  20180410<br>
</li><li>MEG system: high density 275 Channel system (<span style="font-family:Cambria,Georgia,"Times New Roman",Times,serif,serif,EmojiFont">MISL CTF )</span><br>
</li></ul>
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt"><br>
</div>
- Code specific info:</div>
<div id="x_divtagdefaultwrapper" dir="ltr" style="">
<ul style="margin-bottom:0px; margin-top:0px">
<li style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
We are using .ds files for each subject</li><li style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
We have continuous data</li><li style=""><span style="font-size:12pt">We have a custom trial function (which so far seems to be working fine)
</span>
<ul style="">
<li style=""><span style="font-size:12pt">however it doesn't seem to take it into account (I tried to use cfg.trialfun as well as cfg.trl ).Giving the warning trialfun not specfied
</span>
<ul style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
<li style="font-size:12pt">I also tried other different fields (and combinations) for the cfg (I put down most of them in the down below code but I am not fully sure in how far they are recognized) </li></ul>
</li><li style="">I could imagine this being the core of the issue</li></ul>
</li></ul>
- The code: <br>
</div>
<div id="x_divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
%%define trial</div>
<div dir="ltr" style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
<div>cfg=[];<br>
cfg.trialdef.eventtype='trial';</div>
<div>cfg.trialfun = 'our_trialfun';<br>
cfg.dataset= datapath; <br>
[trl, event] = our_trialfun(cfg);</div>
<div>cfg = definetrial(cfg);<br>
%% Inspect data<br>
cfg = [];<br>
cfg.trl = trl;<br>
cfg.channel ={'MEG'};</div>
<div>cfg.trialdef.eventtype= 'trial';</div>
<div>cfg.trialfun = 'our_trialfun'<br>
cfg.continuous = 'yes';<br>
cfg.savemat = 'no';<br>
cfg.saveplot = 'no';<br>
cfg.dataset = datapath; <br>
</div>
<div>cfg.plotunit = 500;<br>
[info,timelock,frq,summary,headpos]=ft_qualitycheck(cfg);</div>
<br>
</div>
<div id="x_divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">
%%%custom trial function<br>
function [trl, event] = our_trialfun(cfg)<br>
event = ft_read_event(cfg.dataset);<br>
hdr = ft_read_header(cfg.dataset);<br>
<br>
cfg.trialdef.prestim  = 0.2; %seconds<br>
cfg.trialdef.poststim = 0.7; <br>
pretrig = -round(cfg.trialdef.prestim*hdr.Fs);<br>
posttrig = round(cfg.trialdef.poststim*hdr.Fs);<br>
<br>
con_labels = {'LOW_W';'HIGH_W';'LOW_W';'HIGH_W';'HIGH_F';'LOW_F';'HIGH_F';'LOW_F'};<br>
con_values = {'11'; '12'; '13'; '14'; '15'; '16'; '17'; '18'};<br>
<br>
%a = {event.type}';<br>
a= {event.type};<br>
sample = [];<br>
for j=1:length(con_values)<br>
    for i=1:length(a)    <br>
    %if a{i} == con_values{j}<br>
value = [event(find(strcmp(con_values{j},{event.type}))).value]'; <br>
newsample = [event(find(strcmp(con_values{j},{event.type}))).sample]';<br>
    %end<br>
    end<br>
    sample = [sample; newsample];<br>
    sample = sortrows(sample);<br>
end <br>
<br>
trl = [];<br>
for i = 1:length(sample)<br>
    trlbegin = sample(i) + pretrig;<br>
    trlend = sample(i) + posttrig;<br>
    offset = pretrig;<br>
    newtrl = [trlbegin trlend offset]; <br>
    trl = [trl; newtrl];<br>
end<br>
end</div>
<div style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
<br>
</div>
<span id="ms-rterangepaste-end" style="font-size:12pt"></span>Thank you,<br>
<br>
Hannah 
<p style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
</p>
</div>
</div>
</div>
</div>
</body>
</html>