discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] How to use the read_float_binary.m function


From: wallen
Subject: Re: [Discuss-gnuradio] How to use the read_float_binary.m function
Date: Fri, 28 Oct 2011 08:06:40 -0600

On Thu, 2011-10-27 at 19:00 -0600, hasanimam wrote:
> Hello,
> 
> I am in deep deep trouble. And it would be really great if somebody come up
> with any sort of help.

Well, here is the code I cobbled together to do this. It is nothing
fancy.

- Wayde

-------------------------------------------------------------------------------


#!/usr/bin/env python

import sys, struct

if len(sys.argv) != 2:   # Need to have one input data file
                         # Print out splash banner in case the filename
                         # isn't entered correctly

      print
      print '   [gr_raw2num.py, Version 20100308 by J. Wayde Allen]'
      print
      print '   NAME:  gr_raw2num.py  '
      print
      print '   USAGE:  gr_raw2num.py filename'
      print
      print '   DESCRIPTION:'
      print
      print '   Converts raw complex float data to complex'

else:

   myfile = sys.argv[1]
   f = open(myfile, 'rb')
   eof = False

   while not eof:
      try:
         chunk = f.read(8)
         a,b = struct.unpack('ff',chunk)
         value = complex(a,b)
         print a, b
      except:
         eof = True




reply via email to

[Prev in Thread] Current Thread [Next in Thread]