Mark epochs of interest from a list of timestamps extracted from matlab

Hello guys!

Is it possible to create my epochs of interest from a matlab matrix containing timestamps?

I'm working on brainstorm with .TRC files of about 1 hour 30 minutes duration, which are intracerebral recordings of an epileptic patient. I have access to three nights, divided into 21 .TRC files. I've imported my electrode coordinates, I've done the preprocessing and now I'd like to mark my epochs of interest, the different sleep stages encountered during the night.

To find out the timestamps of each stage, I used a matlab algorithm to obtain a list of 30-second epochs, each with a sleep stage categorization (W, N2, N3, R) and a confidence score. I keep only the epochs categorized with a high confidence score. Since I want to compare different sleep stages, I'd like to create W, N2, N3 epochs on brainstorm and analyze my conditions.

The problem is that I find myself having to manually annotate >3000 epochs and that's going to take a long time. So I'd like to know if there's a way to automate the process by using a matlab variable containing in the first column a timestamp (or epoch number) and in the second a name for the epoch, and finally a file number. Or what format should my matlab variable have?

I should point out that my algo only accepts .EDF files as input and that it doesn't allow file annotation, so I have no way of annotating my files before importing them into brainstorm.

I've tried looking on the forum or via the tutorials but haven't found anything like this.

Thanks in advance for your advice,

Yes, it is possible. The idea would be to import the timestamp and type of epoch as a marker with the option Add events from file. You will need to save your Matlab variable as a file, e.g., a .csv file. The marker can be either simple (indicating only the start of the epoch) or extended (indicating the start and duration of the epoch).

Check this post:
How to add new events to Brainstorm - #2 by Raymundo.Cassani
Also, more info on events in Brainstorm can be found here:
https://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers

Many thanks @Raymundo.Cassani for your fast and helpful reply. I did manage to add my event following your procedure. :slight_smile: