Reading Metadata file header from Octave

Did someone write an Octave/matlab code to read the metadata saved using
“File Meta Sink” block in GRC, set in detached mode?

I am using GRC 3.7.1. I obtain an header file 342 byte in size. I am
interested in extract from the file the rx_rate and rx_time.

In the file “” I read the following, where I don’t
know how bytes are used for METADATA_VERSION data.

  d_header = pmt::make_dict();
  d_header = pmt::dict_add(d_header, pmt::mp("version"),

d_header = pmt::dict_add(d_header, pmt::mp(“rx_rate”),
d_header = pmt::dict_add(d_header, pmt::mp(“rx_time”), timestamp);
d_header = pmt::dict_add(d_header, pmt::mp(“size”),
d_header = pmt::dict_add(d_header, pmt::mp(“type”),
d_header = pmt::dict_add(d_header, pmt::mp(“cplx”), complex ?
pmt::PMT_T : pmt::PMT_F);
d_header = pmt::dict_add(d_header, pmt::mp(“strt”),
d_header = pmt::dict_add(d_header, mp(“bytes”),

Best regards


I have been able to locate, inside the metadata header file, only the
rx_rate, the rx_freq but not the rx_time couple.

For rx_rate I used the following Octave instructions:

f = fopen (filename, ‘rb’);

dummy=fread(f,50,‘uint8’); % to skip first 50 bytes

rx_rate = fread (f, 1, ‘double’,‘b’) % data are in big-endian order

Any suggestion on how to locate rx_time touple ???


Piero, I0KPT

Here you can find attached the header file I am trying to read.


Piero, I0KPT

I finally got the solution.

Here is a function that extracts the data I needed from metadata header

function v = read_header_binary (filename)

f = fopen (filename, ‘rb’);

dummy=fread(f,50,‘uint8’,‘b’); % skip first bytes

rx_rate = fread (f, 1, ‘double’,18,‘b’)
rx_time_a = fread (f, 1, ‘uint64’,1,‘b’) % seconds
rx_time_b = fread (f, 1, ‘double’,69,‘b’) % fraction of seconds
rx_freq = fread (f, 1, ‘double’,‘b’)

fclose (f);

v=[rx_time_a, rx_time_b, rx_rate, rx_freq];



Piero, I0KPT

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