EEG_EVENTFORMAT Convert the event information of a dataset from struct to array or vice versa.

Usage: >> [eventout fields] = eeg_eventformat( event, 'format', fields );

Inputs:
event   
event array or structure
format   
['struct'|'array'] see below
fields   
[optional] cell array of strings containing the names of the event struct fields. If this field is empty, it uses the following list for the names of the fields { 'type' 'latency' 'var1' ... 'var2' ... }.

Output:
eventout   
output event array or structure
fields   
output cell array with the name of the fields

Event formats:
struct   
Events are organised as an array of structs with at least two fields ('type' and 'latency') (Ex: reaction_time may be type 1).
array   
events are organised as an array, the first column representing the type, the second the latency and the other ones user-defined variables.

Note: 1) The event structure is defined only for continuous data
or epoched data derived from continuous data.
2) The event 'struct' format is more comprehensible.
For instance, to see all the properties of an event i,
type >> EEG.event(i)
Unfortunally, structures are awkward for expert users to deal
with from the command line (Ex: To get an array of latencies,
>> cell2mat({EEG.event(:).latency})')
In array format, the same information is obtained by
>> EEG.event(:,2)
3) This function automatically updates the 'eventfield'
cell array depending on the format.

Author: Arnaud Delorme, CNL / Salk Institute, 27 Jan 2002

See also: eeglab, pop_selectevent, pop_importevent

See the matlab file eeg_eventformat.m (may require other functions)

Back to functions