GNU Radio File Format for the recorded samples

后端 未结 1 1909
Happy的楠姐
Happy的楠姐 2021-01-06 00:31

Do you know the format in which GNU Radio ( File Sink in GNU Radio Companion) stores the samples in the Binary File?

I need to read these samples in Matlab, but the

1条回答
  •  太阳男子
    2021-01-06 01:16

    The file sink is just a dump of the data stream. If the data stream content was simple bytes then the content of the file is straightforward. If the data stream contained complex numbers then the file will contain a list of complex numbers where each complex number is given by two floats and each float by (usually) 4 bytes.

    See the files gnuradio/gnuradio-core/src/lib/io/gr_file_sink.cc and gr_file_source.cc for the implementations of the gnuradio file reading and writing blocks.

    You could also use python and gnuradio to convert the files into some other format.

    from gnuradio import gr
    # Assuming the data stream was complex numbers.
    src = gr.file_source(gr.sizeof_gr_complex, "the_file_name")
    snk = gr.vector_sink_c()
    tb = gr.top_block()
    tb.connect(src, snk)
    tb.run()
    # The complex numbers are then accessible as a python list.
    data = snk.data()
    

    0 讨论(0)
提交回复
热议问题