Here I present a Python script I put together to extract the onset and duration data from PsychoPy logfiles and to create the .m files formatted for Matlab. Even if you don't use PsychoPy you might still benefit from the parts of the script that creates the .m file.
You can download the Python script from the link at the bottom (change the extension to .py once you download). You will need to tweak it a bit before it can work with your logfiles.
This is how the output .m file (for one subject) should look like. There are three conditions (2 task, 1 baseline) and for each condition you have a separate sublist of names, onsets, and durations.