I have a file with some data in it I converted to 16-bit signed integers with Matlab. I am running a C program that I want to read the file, and display each integer by reading the integers 8-bits at a time, and then I'm "shifting" each of these bytes, into a short integer, so I kinda get the 16-bit integer back as a short integer.
My data values range from about -2000 through about 9000. The program does display the points from the file, but the negative points seem to be "wrapped" around to the upper limit of signed short integers. Once the data points start to decrease and become negative, 65535 becomes the new "0-point" and they decrease until like 63500 or something, (about 2000 below 0), and will climb back up and then go back to the 0 - 9000 range when they should be positive again.
This is quite strange and I can not seem to figure out why it is happening. I know Matlab made my data signed, because I double checked my script that did that, and when I changed it to make my data into 16-bit unsigned integers, negative numbers became straight 0's after being run through the c program, as I would expect.
Thanks in advance for any help offered!