Functions for converting events to numbers

In the cortex code we use text strings to code for events but they have
to be converted to intgers in the data files. These functions does the
same in matlab.