Here is a program I wrote in python with a TCP server that receives the motion parameters, plus one value for a ROI mask average, and plots it in real time. You should be able to get everything you need from the first three functions. It is reasonably clear and well-commented. It took me a long time to figure out how this stuff worked, so I figure this should save you some trouble! :)
[
brainimaging.waisman.wisc.edu]
I have no idea what would be involved in writing a TCP server in Matlab, that's not really what Matlab is for, although at this point they've tacked every imaginable thing onto it (just like every other language, of course.) And if you need threading, it will be very tricky, here's a conversational thread about threading in Matlab:
[
forum.allaboutcircuits.com]
I recommend python, for no reason other than that the code I sent you will give you almost everything you need.... :)
I did get a lot of the info for this from looking at the serial_helper source code. Hint: google "serial_helper.c" clever, huh?
-dave