Script to duplicate and merge event codes

You have two cell arrays of strings (read a few tutorials about cell arrays in Matlab first):

{sRaw.F.events.label}
{'31,'33', '35', '37', '39', 41', '43', '45'}

To test if each of the elements in the first list is part of the second list, use something like to get a list of event indices:

iEvtTop = find(ismember({sRaw.F.events.label}, {'31,'33', '35', '37', '39', 41', '43', '45'}));

Grouping all the occurrences of all these events could look like something like this:

[sRaw.F.events(iEvtTop ).times];

After that, ideally you need to sort all the occurrences by time, to get a correctly defined Brainstorm structure, and then apply the same sorting to all the other arrays (epochs, channels, notes...) if they vary.

All this will probably require you teach yourself some more Matlab programming first. This forum is dedicated to providing help and support specifically for the Brainstorm software. We can help you with some specific details you are stuck with, but unfortunately we won't be able to guide you through all the steps of the development of your personal Matlab scripts.

Welcome and enjoy the training!