Export (from Motion Tracking) tracker coordinates for each frame to text file

Is there a script for exporting the object tracker coordinates for each frame to a text file (so that it can be used in another program)? I know that there is a Marker panel with the Position X and Y, but I need it as a text file for each frame for the entire film.

Here’s the link for camera: http://scummos.blogspot.de/2012/11/blender-exporting-camera-tracking.html and the link for object is at the bottom of the page. I had to change the address of the file to be saved to in the script and it works great!