Importing data events

I would like to suggest the following small improvements to the code is you agree

  1. In process_import_data_event.m, Line 332
    % Exclude duplicates
    iSelEvents = unique(iSelEvents,'stable');
    Adding a 'stable' to the unique command keeps the events in the same order as requested. For example, if I requested [condition-1 condition-2], having a 'stable' command will pull the conditions in the requested order irrespective whether condition-1 or condition-2 appeared first in the file.

  2. In the file in_data.m when pulling blocks of data based on trigger lines 271 - 277, I suggest adding 'EvtTime' which will save the time stamp of occurrence of the trigger in the data structure 'DataMat'
    BlocksToRead(end).EvtTime =;
    Between line 340-347,
    DataMat.EvtTime = BlocksToRead(iFile).EvtTime;
    This will be helpful to make sure trial order is preserved.

Hi @gopalar,

Thank you for your suggestions.

This will change the order epochs get imported, however, in the tree they are sorted alphabetically.
Without arguments unique returns the unique elements sorted in ascendant order. Ascendant with respect to the order in which they were initially imported in the raw file.
I'm not seeing what would be the benefit of adding the option 'stable'.

The DataMat structure (link) is used in many places in Brainstorm, modifying may get more troubles than benefits. The beginning and end times for the each epoch with respect to the entire file can be found in the History field in of DataMat (link)

The order of the trials is kept as for each event, the epochs around the occurrences are imported chronologically.