Question on using gr.file_source

Hi! I’, quite new to GNU Radio and I was wondering whether I could
access via index the values obtained after the gr.file_source()
command?

I mean, could I retrieve contents just as if it were an array? Thanks!

On Sunday 13 January 2008 13:15:54 Jason A. wrote:

Hi! I’, quite new to GNU Radio and I was wondering whether I could
access via index the values obtained after the gr.file_source()
command?

I mean, could I retrieve contents just as if it were an array? Thanks!

You can send it to a gr.vector_sink_* and then get an array using
data().

Martin

I have a problem. Let’s say that Rx1 stores the output of a
gr.file_source()
operation. I want to extract its contents so that I could access it as
an
array. You said that I use gr.vector_sink(). However, gr.vector_sink()
doesn’t take any input arguments… =(

So basically, how would it know that I want to extract values from the
Rx1
stream when I have other input streams?

Thanks!

Jason A. wrote:

You can send it to a gr.vector_sink_* and then get an array using
data().

Martin

Jason,

As Martin said, you need to get the array using data = <vector_sink
object>.data()

To do this, you want to stop the flow graph. In the case of using a file
source, just run the contents of the file through once and the flowgraph
will terminate after an ‘fg.wait()’. Then, call the data accessor
function of the vector sink, which returns a list. You can then access
the items of the list like you want.

Tom

Hello again!

I still have the same problem. Unfortunately, I still can’t make
gr.vector_sink to work. I mean, how would it know that I just want to
extract data from a particular source. Let’s say I have these codes:

yrx1_real = gr.file_source(‘arguments omitted’)
yrx1_imag = gr.file_source(‘arguments omitted’)

Rx1_real = gr.vector_sink_f() ??? I like it to process yrx1_real only.

So basically that’s still my problem… =)