discuss-gnuradio
[Top][All Lists]
Advanced

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

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


From: Sangho Oh
Subject: [Discuss-gnuradio] Change of complex binary file format for Matlab.
Date: Thu, 13 Jan 2011 00:00:37 -0500

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>));


--

reply via email to

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