discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Change of complex binary file format for Matlab.


From: Alan Jones
Subject: Re: [Discuss-gnuradio] Change of complex binary file format for Matlab.
Date: Thu, 13 Jan 2011 07:51:52 +0200

Hi

I am not that coded up on UHD, but I would think that they have the same type of file writing system as is used in the GNU Radio code. In the GNU Radio code they use a binary file writing system. I have attached a matlab M file that reads these types of files, the file can be found in GNU Radio file address ~/gnuradiio/gnuradio-core/src/utils. There are a large number of matlab M files there so just have a look for the type of stuff you want to do.

Hope it help

Regards
Alan Jones

On 13 January 2011 07:00, Sangho Oh <address@hidden> wrote:
Hello,
I am trying to use "rx_samples_to_file.cpp" in UHD to save samples received.
UHD seems save samples in complex integer format in c++.
However, it is not possible to read that format from Matlab.
I have checked the Matlab utilities in Gnuradio, but they were not useful.
Is that any simpler way to change the formats of the saving file so that Matlab can easily read?

Another question is that why the saved samples are integer format? not float?
Thanks for reading.

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

    std::vector<std::complex<short> > buff(dev->get_max_recv_samps_per_packet());
    std::ofstream outfile(file.c_str(), std::ofstream::binary);

    while(num_acc_samps < total_num_samps){
        size_t num_rx_samps = dev->recv(
            &buff.front(), buff.size(), md,
            uhd::io_type_t::COMPLEX_INT16,
            uhd::device::RECV_MODE_ONE_PACKET
        );

        outfile.write((const char*)&buff[0], num_rx_samps * sizeof(std::complex<short>));


--

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Attachment: read_complex_binary.m
Description: Text Data


reply via email to

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