Mixed / non-char elements in EEG.event.type field

Multiple functions perform operations on EEG.event.type field. Some functions compare type to a given string, e.g. 'blink'. Other CTAP functions add events where the type field is of type char. These functions all expect type to be char, and thus {EEG.event.type} to be a cell array of strings.

However this field is often numeric, depending on the EEG recording system.

Three (or four?) solutions seem possible:

  1. convert EEG.event.type to be char when first loading data, in ctapeeg_load_data()
    • problem: this will be a permanent change to the data, which may be contrary to users' preferences
    • problem: introduces tricky 'hidden' code doing funny things at unexpected places
  2. convert EEG.event.type to be char 'in the loop', i.e. for the duration of each step set. Replace the converted field with the original before saving .set files, or convert back to numeric all elements which can be converted
    • problem: solution is messy, as conversion must take place after initial loading, and also after loading from intermediate stepset files = 2 separate places in CTAP_pipeline_looper()
  3. handle the issue 'on the spot', wherever operations are currently performed on {EEG.event.type}: 3a. A helper function could be written that takes the field name required (type in this case), and returns the required cell array with all elements converted to char. 3b. The required comparisons could be restricted to those parts of the {EEG.event.type} that are already char (on the assumption that if you are looking for, e.g. 'blinks', then events with numeric type can be safely excluded)

EDIT Have just discovered that due to the excellent way pop_epoch() is coded, having mixed values in EEG.event.type is going to always fail, ruling out solution 3a/b

EDIT Going with solution 1 for now. Pushed to dev