<div dir="ltr"><div>Hello all! I'm having a simple problem. I want to add this trialfun:</div><div><br></div><a href="http://fieldtrip.fcdonders.nl/faq/how_can_i_transform_trigger_values_from_bits_to_decimal_representation_with_a_trialfun" target="_blank">http://fieldtrip.fcdonders.nl/faq/how_can_i_transform_trigger_values_from_bits_to_decimal_representation_with_a_trialfun</a><br><div><br></div><div>I get this error:</div><div><br></div><div><div>Reference to non-existent field 'trialdef'.</div><div><br></div><div>Error in trialfun_bit2dec (line 52)</div><div>  if strcmp(event(i).type, cfg.trialdef.eventtype)</div></div><div><br></div><div>I'm quite sure it's because I'm not writing it in the correct part of my script. This is my trial definition part. Where should I add it and how should I write the line?</div><div><br></div><div><div>  % TRIAL DEFINITION</div><div>    cfg=[];</div><div>    cfg.filename = ['my/folders/', subject, '.RAW']; </div><div>    cfg.headerfile = ['my/folders/', subject, '.RAW']; </div><div><br></div><div>    cfg.trialdef.eventtype    = 'STATUS';</div><div>    cfg.trialdef.eventvalue   = cgrmrk; </div><div>    cfg.trialdef.prestim      = 0.2; </div><div>    cfg.trialdef.poststim     = 1;   </div><div>    cfg.trialdef.eventtype=?;</div><div><br></div><div>    cfg = definetrial(cfg);</div><div><br></div><div>    trl = cfg.trl;</div><div>    cfg=[];</div><div>    cfg.dataset = ['my/folders/', subject, '.RAW']; </div><div>    cfg.trl           = trl;</div><div>    cfg.reref         = 'yes';</div><div>    cfg.refchannel    = ['all'];<span class="" style="white-space:pre">                                     </span>  </div></div><div><br></div><div>THANKS!</div></div>