discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Re: Capture File format


From: Jonas Hodel
Subject: [Discuss-gnuradio] Re: Capture File format
Date: Wed, 09 May 2007 09:57:11 +1200
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)


Hello.

I have an array in MATLAB that is the IQ data in complex form of a
capture from my hardware.  I wish to now feed this to GNURadio.  What
format do I export/save this array to file? Are there any example .m
files floating around for this task?

There are some utility .m files located here:
    http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/utils
I have noticed a couple of those files were originally written for Labview and not quite fully ported to Matlab (I think). However, the fixes are very minor. Here is a write_complex_binary script that should do the trick.
I believe using the write_float_binary.m to interleave complex data
should yield correct results, but I could be completely wrong.
I don't think write_float_binary interleaves.

Either way, check out the files located there.

Brian



=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================

%
% Copyright 2001 Free Software Foundation, Inc.
% 
% This file is part of GNU Radio
% 
% GNU Radio is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
% 
% GNU Radio is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with GNU Radio; see the file COPYING.  If not, write to
% the Free Software Foundation, Inc., 51 Franklin Street,
% Boston, MA 02110-1301, USA.
% -------------------------------------------------------------------------
% write_complex_binary(): Writes complex samples to a file that can then be
% used by a GNU Radio file source.
%
% Inputs:
% 
% - data: An array of complex samples.
% - filename: Name of the file that will be written.
%
% Example:
%
% write_complex_binary(complex_data, 'test_tone.dat');
% -------------------------------------------------------------------------
function v = write_complex_binary (data, filename)


    m = nargchk (2, 2, nargin);
    if m
        usage (m);
    end

    f = fopen (filename, 'wb');
    if (f < 0)
        v = 0;
    else
        
        data_real = real(data);
        data_imag = imag(data);

        interleaved = zeros(1, 2*length(data_real));
        interleaved(1:2:end) = data_real;
        interleaved(2:2:end) = data_imag;
        v = fwrite (f, interleaved, 'float');
        fclose (f);
    end
end

=======================================================================
This email, including any attachments, is only for the intended
addressee.  It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
 altered or corrupted during transmission.
=======================================================================


reply via email to

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