[FieldTrip] Brain Vision Segmented

Michael Glassen - Biomedical Engineer MGlassen at kesslerfoundation.org
Tue Oct 12 07:53:13 CEST 2021


Hi Hannah,

I checked the source code for ft_trialfunbrainvision_segmented(https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_brainvision_segmented.m), and going backwards from line 90 where your error occurred it seems that the function is expecting at least 2 events to be located in the file(one titled ‘New Segment’ and one directly after titled ‘Time 0’.) I believe if your data is missing the ‘Time 0’ event for some reason then the code would error out at this point.

 I haven’t used Brain vision analyzer but I would guess this event is added automatically but for some reason got removed(during removal of artifacts in the first few samples of an epoch/trial perhaps). I would try re-rejecting data and avoiding the very beginning of trials, and if that doesn’t work/you haven’t rejected data, then adding an if statement at line 89 to handle an empty t0 variable should be your next step.

I don’t have matlab open to help debug, but the code seems to expect there to be some delay between the ‘New Segment’ event and the ‘Time 0’ event and this is what t0 helps to account for. You could either set t0 = 0, which will use the sample for the ‘New Segment’ variable as the first sample(risky, assumes the delay until the ‘Time 0’ event is negligible), or you can use matlabs continue function to skip that trial(although this approach might cause other issues in the code).

Good luck, hope this helps!

Michael Glassen
--------------------------------------------------------------------------
Michael Glassen, M.S.
Biomedical Engineer
Human Performance and Engineering Lab
Kessler Foundation
1199 Pleasant Valley Way, West Orange, NJ, 07052<https://www.google.com/maps/search/1199+Pleasant+Valley+Way,+West+Orange,+NJ,+07052?entry=gmail&source=g>
Tel: (973) 324 3526
Email: mglassen at KesslerFoundation.org<mailto:mglassen at KesslerFoundation.org>




On Oct 12, 2021, at 12:35 AM, Hannah Anderson via fieldtrip <fieldtrip at science.ru.nl> wrote:


Hello all,

I was hoping to get some assistance with the following
My supervisor has segmented data pre-processed in Brain Vision Analyser which I am trying to read into fieldtrip, but when I try and define trials using ft_trialfun_brainvision_segmented I get this error

Index exceeds the number of array elements (0).

Error in ft_trialfun_brainvision_segmented (line 90)
  t0 = t0(1); % take the first one in case there are multiple

Error in ft_definetrial (line 183)
    [trl, event] = feval(cfg.trialfun, cfg);

Thanks,
Hannah


Hannah Anderson

​My pronouns are she/her/hers

Research Assistant – Healthy Brain Ageing

BBiomedSc (Accel)
Thompson Institute

USC


Tel: +61 5430 1133

handerson at usc.edu.au<mailto:mparker4 at usc.edu.au> | usc.edu.au/thompson-institute<http://usc.edu.au/thompson-institute>

<Outlook-mbvdqpsd.png>


I acknowledge the Traditional Custodians of the lands and waters upon which the University's campuses are located.

I acknowledge their continuing connections to country and pay my respects to Elders past, present and emerging.



University of the Sunshine Coast  l  CRICOS 01595D

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates email defenses with brand protection, security awareness training, web security, compliance and other essential capabilities. Mimecast helps protect large and small organizations from malicious activity, human error and technology failure; and to lead the movement toward building a more resilient world. To find out more, visit our website.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211012/dd042200/attachment.htm>


More information about the fieldtrip mailing list