You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
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()
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
The text was updated successfully, but these errors were encountered:
On reflection, seems like problems listed for solution 1 are not so bad, since it is not hard to convert back to numeric (str2double() or similar will just give NaN for entries that are not numbers, and isnan() can filter those). So going with solution 1 and closing
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 thetype
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:
ctapeeg_load_data()
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{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 inEEG.event.type
is going to always fail, ruling out solution 3a/bEDIT Going with solution 1 for now. Pushed to dev
The text was updated successfully, but these errors were encountered: