On 03/04/2023 04:12, DİREN ERDEM AYDIN wrote:
Thanks for the response Marcus appreciate it!

But can you explain more how can I use "constructed" filename that includes frequency information? I have QT GUI Range which has ID lo_freq, when I tried to insert that info into file sink's file section like "C:\Users\aydindi\Desktop\sept_2\buff1_lo_freq.txt", extracted file does not contain numerical freq info as expected..

I can handle multiple separated txt files in matlab using a for loop. I would like to modify file sink like (' buff1_%d.txt ', lo_freq) but I am not quite sure about the file section accepts this kind of input.
for i=1:6
f = fopen(sprintf('pll_re_1_3_%d.txt', i), 'rb');
rx_pll_re{i} = fread(f, Inf, 'float');
fclose all;
f = fopen(sprintf('pll_im_1_3_%d.txt', i), 'rb');
rx_pll_im{i} = fread(f, Inf, 'float');
fclose all;
end
The file sink block (I assume you're using GRC to build your flow-graphs?) has a "filename" parameter.  Like most parameters
  in GRC, that parameter actually accepts a python expression, so:

"buff1_%d" % lo_freq

In that parameter field will do what you want.

I strongly suggest learning a bit of Python to use GRC.

Your "for loop" example isn't quite relevant, since GRC uses what's called a "data flow" programming model.  At its top level,
  it's NOT a "procedural" programming environment.



On Mon, Apr 3, 2023 at 12:46 AM Marcus D. Leech <patchvonbr...@gmail.com> wrote:

    On 02/04/2023 17:41, DİREN ERDEM AYDIN wrote:
    Dear all,

    I would like to modify the file sink so that when I changed the
    receiver frequency during simulation, the file sink will create a
    new file and record new frequency data there. Is it possible to
    do that? and where can I find the source code of the existing
    file sink in gnu radio?

    Regards,
    dea

    ------------------------------------------------------------------------
    /Yasal Uyarı: MEF ÜNİVERSİTESİ bu mesajın içeriği ile ilgili
    hiçbir yasal sorumluluk taşımaz./
    /Legal Disclaimer: MEF UNIVERSITY does not accept any legal
    liability or responsibility for the content of this message./
    You don't need to modify the filesink to do that.  You just have
    to use a "constructed" filename that includes frequency information.
      When the filename changes, the filesink will automatically close
    the current file and start a new one under the new name.

    Gnu Radio source is on github:

    https://github.com/gnuradio/gnuradio

    gr-blocks/lib   is where filesink_impl and filesink_base live.



------------------------------------------------------------------------
/Yasal Uyarı: MEF ÜNİVERSİTESİ bu mesajın içeriği ile ilgili hiçbir yasal sorumluluk taşımaz./ /Legal Disclaimer: MEF UNIVERSITY does not accept any legal liability or responsibility for the content of this message./

Reply via email to