Error in out_fwrite_bst.m

The fix you propose may work (= not crash), but does not produce the expected result: it saturates the list of indices in iNewF, which causes to copy the last value multiple times at the end of the segment written to the file.
What we should do instead is to fix the definition of the iNewF list of indices.

Could you please share some short example data file with which we could reproduce and debug this issue?

  • Try to extract only a few seconds of data from this FieldTrip structure
  • Make sure you get exactly the same error when trying to link it into Brainstorm
  • Upload it somewhere (dropbox, google drive, wetransfer...)
  • Post the download link

Thanks