I'm using Brainstorm to pre-process EEG data in order to use it with Machine Learning algorithms.
For each subject I have 4 trials of 1min each. I cleaned the artifacts using ICA/SSP methods on the continuous file. Sometimes, I have remaining small artifacts or events that I mark as "Bad segments".
Does this method (marking segments as bad) work to save the final data without the bad segments into my Matlab file?
No, marking some segments of recordings as bad would not remove them from the data matrix available in the database. It you then export this file to a file outside of the Brainstorm database (popup menu File > Export file), your bad segments would still be in there.
You could try removing these segments by yourself in Matlab, using the information from the .Events field of the imported recordings (https://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers#On_the_hard_drive).
Otherwise, you could re-epoch your recordings in small blocks after marking the bad segments (right-click on the clean file > Import in database), selecting the option "Split in time blocks" with a short duration. The small chunks overlapping with a bad segments would be marked as bad, and therefore ignored when selected in the Process1 list. Select all the small chunks in Process1, and run process "Standardize > Concatenate time". The concatenated file would not contain anymore the bad segments.
Note that we do not offer any easy solution for this because this is not a recommend procedure in most cases. Cutting out bad segments create discontinuities in the signal, which cause all sort of issues when processing the signals.