Question: How to read file contents

Hi!

Since no one has responded to my post regarding my problem on reading a
file. I will post another message regarding this. But instead, I’ll ask
a
very basic question.

How do you read contents from a file using GNU Radio blocks? I always
get an
empty list when I try to run the code that I posted here like 5 days
ago…

P.S.

I really wish GNU Radio has a better user manual just like MATLAB. I
mean, I
posted a very basic question and I’m expecting answers by now.

Hi Jason,

Jason A. wrote:

Hi!

Since no one has responded to my post regarding my problem on reading a
file. I will post another message regarding this. But instead, I’ll ask
a very basic question.

I think it’s because your post is a little unclear.

When you say “I have a problem reading an ascii file” …is it binary
float data? Is it string representation of numbers? It makes a big
difference. When you say “ascii” I interpret this as “12.5” in text
format which is not what gr.file_source is going to parse.

How do you read contents from a file using GNU Radio blocks? I always
get an empty list when I try to run the code that I posted here like 5
days ago…

It all depends what is in this file, as I stated before. Your code is
attempting to read a binary file of floats:
yrx1_real = gr.file_source(gr.sizeof_float,{file location},FALSE)

is it really a binary file of floats? or is it:
12.7
234.5
… etc

Aside from that, you never actually start your flow graph. I’ve never
used wait(), but I’m pretty sure you still need to fg.start() …
otherwise it never starts and you never ever get data in what you’re
trying to read. It’s always going to be whatever it’s initialized as.

P.S.

I really wish GNU Radio has a better user manual just like MATLAB. I
mean, I posted a very basic question and I’m expecting answers by now.

GNU Radio is open source, unlike MATLAB. That means you literally have
everything documented in code. If you’re not sure how a block works,
you just look at the code. Search the mailing list for some of Firas’
posts about the documentation he is generating. Here’s a small guide I
found from google:
http://www.nd.edu/~jnl/sdr/docs/tutorials/9.html

The code always evolves, it’s hard to keep manuals up to date, which is
why the code itself is usually the best documentation :slight_smile:

  • George

Hi!

Thanks for your reply!

Yes, the file contains a string representation of floats. So I suppose
that
the file should contain a binary representation of floats?

And, yes I did start my flow graph. I would like to apologize for not
including it in my post. But, rest assured that I ran my flow graph. :slight_smile:

I will try your suggestion ASAP!

Hi,

Jason wrote :
I really wish GNU Radio has a better user manual just like MATLAB.

There is a simple GNU Radio manual (simple documentation) at :

http://rapidshare.com/files/72169239/Simple-Gnuradio-User-Manual-v1.0.pdf

It is now simple, but I intend to rich it much once I finish patching
the
GNU Radio source code documentation.

Firas A.

View this message in context:
http://www.nabble.com/Question%3A-How-to-read-file-contents-tp15150372p15153688.html
Sent from the GnuRadio mailing list archive at Nabble.com.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs