How to save a matrix of integers into a file using GNU Radio

Dear all,
I want to save a matrix of integers into a file, similar to .mat file in
MATLAB. To be more specific, my desire block should receive a stream of
integers, convert it to MxN matrix and save this matrix so that I can
get this data for further process after the flow graph stops.
Could you give me some clue to do this in GNU Radio?
Thank in advance,Hoang

Hoang Ngo-KhacResearch Assistant - Lab. of Signal and System, FET, UET,
Vietnam National University-Hanoi (VNU-H)Alternative email:
[email protected], [email protected]:
+84.163.682.7874

In the Python domain, you have lots of tools at your disposal, such as
Pickle (you can even use scipys io module to write .mat files if you
like).

If you are using PMTs, you can use the metadata file sink.

M

I’m not familiar with python. I’ve written a C++ block to write integers
to a text file. I use fstream.h library. Some code in general work
function:
std::ofstream fw(d_filename); unsigned char iptr = (unsigned
char
)input_items[0]; if (fw.is_open()) { for(int i =
0; i < noutput_items * d_vlen; i++) {
d_data.push_back (iptr[i]); if (((i+1)%10) == 0) fw<<(int)
d_data[i]<<std::endl; else fw<<(int) d_data[i]<<" ";
} fw.close (); } else throw
std::runtime_error(“Error: Can’t open file”);
When I connect this block directly to one source clock (e.g. Vector
Source), this block successfully captures all the input data and write
them to text file.
However, when I used this block at the end of a OFDM simulation flow
graph, it only wrote very few data to the file though I keep the flow
graph running for long time. I printed the input data in Terminal window
and see that the data stream still flow continuously.

Hoang Ngo-KhacResearch Assistant - Lab. of Signal and System, FET, UET,
Vietnam National University-Hanoi (VNU-H)Alternative email:
[email protected], [email protected]:
+84.163.682.7874