Home › Forums › Software Development › EyeX gaze data stream in Matlab › Reply To: EyeX gaze data stream in Matlab
Thank you for your reply.
Just to confirm, it is not possible to pass function pointers from Matlab to a dll (http://uk.mathworks.com/matlabcentral/newsreader/view_thread/255164). A fully Matlab-based solution is therefore not possible.
An intermediate solution would be to wrap any calls to commands requiring function pointers in mex functions (e.g., http://www.mathworks.com/matlabcentral/answers/100602-how-do-i-create-a-function-pointer-that-points-to-an-matlab-file-using-libpointer-in-the-matlab-gene) – i.e., the mex file provides its own internal callback, which then calls in turn a Matlab callback function.
This would mean that 95% of the code is still written in Matlab, but it means compiling a mex file, which many users would find offputting.
One alternative would be to write a standalone c/c++(/mex) application that is solely responsible for interfacing with the device, and which buffers the incoming data in its own internal buffer. Whenever the user wants to, they could then manually query/poll this wrapper from Matlab, and have it return any new data.
The logic of this would be simpler from an end-user perspective, and it might also be slightly more efficient (although speed should not really be a primary concern given the relatively low sampling rate of the eye tracker)
If anybody gets round to attempting either of these things, I’d love to hear.