We need to get real-time neural signal from Hitachi’s ETG4000. Hitachi provides a MatLab script “RealtimeOT” to get data from a parallel port and convert the binary data to float. Here is what they did:
fp=fopen('temp','w+');fwrite(fp,bindata);fseek(fp,-4,'cof'); floatdata =fread(fp,4,'float'); fclose(fp);delete('temp');
This piece of code will be called a few hundred times per second. Converting data using file is too slow. As a result, the signal we get is not real time at all (delay up to 10s). Indeed, there is a very simple way to do this (typecast):
floatdata=typecast(uint8(bindata), 'single');
Then the program runs very smoothly and there is no delay.
I have read 64 data from my serial port. each two bytes should be combined together to form one 16 bit data. So, what is the function that will make the operation to the whole data. Thank you.