[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] GNU Radio TCP and MATLAB
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] GNU Radio TCP and MATLAB |
Date: |
Thu, 26 Apr 2007 11:02:17 -0700 |
User-agent: |
Mutt/1.5.9i |
On Thu, Apr 26, 2007 at 12:52:40PM -0400, Kevin Rudd (Contractor) wrote:
> Hello again,
> I have decided to try the GNURadio -> TCP -> MATLAB route. I am running
> into a few problems.
>
> First, I downloaded Jamie Cooley's GNURadio TCP Socket code here...
>
> http://alumni.media.mit.edu/~jcooley/gr_experiments/experiments/gr_socket.htm
>
> Then I downloaded a free matlab TCP toolbox as David suggested.
>
> http://www.mathworks.nl/matlabcentral/fileexchange/loadFile.do?objectId=345&
> objectType=file
>
> I can set up the connection and send data to matlab, but the data I receive
> is all messed up. I think the format is off. For those who have done this,
> what data type are you sending and how are you receiving it? Currently, I
> am just sending a complex sine wave. If I sink it to a file, I can open it
> in matlab with no problem. But when I send it via TCP, I get garbage.
>
> My matlab commands are basically...
>
> Con = pnet(sock,'tcplisten');
> data = pnet(con, 'read', 1000, 'SINGLE');
> cdata = data(1:2:end)+j*data(2:2:end);
> plot(log(abs(fft(cdata))))
>
> Is 'SINGLE' the correct type to use? (I tried all the others and I still get
> gargabe).
>
> Thanks for the help,
> Kevin
Not sure about the MATLAB end of things, but gr.file_descriptor_sink
will be sending binary native-endian data. The format will depend on
what you're sending into it. float or gr_complex (== std::complex<float>)
are the usual suspects. Is the MATLAB code expecting binary or ASCII
data?
Eric