Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedInEmail to someone

Background: Testing

As many of you know, we at Geon Technologies have a large body of work using REDHAWK SDR and its Eclipse -based IDE. We also use the FileWriter Component enough that we released our FEI_FileReader Component to then pull RF snapshots back into REDHAWK using the FEI Interfaces spec. It’s a powerful set of capabilities that help us setup container-based unit tests that can scale up to the system-level, all in REDHAWK.

But what if you what if you want to analyze data from REDHAWK in a different tool like MATLAB or Octave? Once again, the FileWriter Component and IDE can both help with getting data into files in either raw BULKIO or X-Midas BLUE -formatted files.

But then what? That’s the issue I ran into because we wanted to take our REDHAWK -based implementations of original MATLAB models and compare the results. After some searching around, I was unable to find an already-prepared BLUE/Platiunum -file format parser for MATLAB that would let me bring snapshots into MATLAB, so, I wrote one.

X-Midas Blue Reader

You can find the source code here.

The goal of this little project is to read all of the header and extended header information from snapshots into MATLAB. I would then take those snapshots and develop analysis tools to help us vet our snapshots against the original MATLAB models at each stage in an algorithm.

The XMidasBlueReader takes the file you want it to manage as the constructor argument:

Header Control Block (HCB)

So what about the header control block? Here’s an example output of a 500KHz bandwidth snapshot captured from an RTL pointed at the FRS band.

Extended Header

The REDHAWK FileWriter Component stores your SRI’s keywords map as a list in the extended header. The XMidasBlueReader imports those as well. In this case, my RTL was pointed in the 462 MHz range of FRS:

For those not familiar with the format, the lkey, lext, and ltag members are length information describing the key in bytes; you can likely ignore those if the type, tag, and value seem sane. The type is the same description as found in the hcf.format(2) position (in this case, double). The tag is your SRI keyword name, and of course the value is the value. Again in this case, it’s pointed at the center of the 462 MHz-oriented FRS channels.


Naturally, snapshots can be extremely large even over short periods of time — often much larger than the default allowed matrix size in MATLAB if you tried to read the entire file at the same time. For example, even this short ~30 second snapshot at 500 Ksps complex float was approximately 96 MB. Recognizing that each complex (2) float (4 bytes) sample is 2×4 bytes, we would need a vector of length ~12 million to get all samples at once.

For me, I have no intention of crunching 12 million samples at once, but I may want the option to bring in a few hundred thousand of them, right?

For reading, use read(num_samples) and rewind(num_samples). The hcb.format field is what defines a sample. For complex-formatted data, it will return a row vector already in complex format, shown here:

Also from the format information is the number of bytes being read per sample which translates to advancing the internal read pointer to prevent reading off the edge of the file. To reset that pointer, use resetRead. You can check if you’re at the start or end of the data buffer using the begin and end methods.

Example Application

Below is a screenshot example application I put together for our team using MATLAB’s App Designer tooling (which is really good, by the way).

The signal in the screenshot is the result of analyzing the FRS signal used in the above examples. The whole application brings in the two different file streams from REDHAWK: spectral analysis output vs. the original signal. Functionality-wise, it provides Next and Previous playback functionality so that the engineers can step through the analysis vs. the characteristics it is identifying.


We hope you all find the XMidasBlueReader as useful as we are! For us, it’s an easy way to “tap” REDHAWK-based algorithms in our Waveforms, and feed the data back through the original model.

If you have ideas for features, or find bugs, please submit issues and/or pull requests against the repository. And of course if you’re interested in any of the above capabilities, please don’t hesitate to contact us.

Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedInEmail to someone

Leave a Reply