1

I Have a .bin file with data in little-endian format 16 bit.
When I use

[Signal,count]=fread(fid,960000,'int16','l');

I get only integer data:

255
-1234
9455
25465
-3546
-6878

How to read this data to get them in complex form? I need to get:

255 - 1234i
9455 + 25465i
-3546 - 6878i
Adriaan
  • 17,741
  • 7
  • 42
  • 75
Natal04ka
  • 45
  • 6

1 Answers1

2

Presuming you have these integers in Signal:

complex_signal = Signal(1:2:end)+1i*Signal(2:2:end)

with indexing! The idea is that your real and imaginary parts are interlaced, i.e. the odd indices, 1:2:end, contain the real part, and the even indices, 2:2:end, the imaginary part. Simply add the two with a factor 1i to get complex numbers.

Adriaan
  • 17,741
  • 7
  • 42
  • 75