Data File Export Function

This export function is intended for sophisticated post-processing, long-term propagation studies etc. It offers a simple (text-file based) interface to other programs like MS Excel. To configure and activate the text file export, select "Text File Format.." under the File menu. This chapter covers:

See also:  Spectrum Lab's main index , interpreter , watch & plot window ,   sample applications .

Defining the contents of the (user-defined) exported file

The following table defines what will be written into the exported file, and how the data shall be formatted. It also contains numeric expressions for all "exported" values.

(Note: There is also a simpler export function for the FFT results, see chapter "Exporting the FFT results").

The export definition table can be modified in this dialog, which can be opened from SpecLab's main menu (under "File"):

The controls on this tab of the File Export dialog are ...

Separator (ASCII)
This is the character code used to separate the columns in the exported text file. If you want to post-process 'spectral' data with Excel, use the TAB character (code 9). If you use the semicolon (code 59), Excel will also import the file properly.
Number of columns
Enter the number of columns for the exported file here. The definition table (below) will have one LINE for every COLUMN of your exported text file, so the number of COLUMNS entered here will immediately affect the number of LINES in the definition table. Currently, up to 30 columns are possible.

File definition table
In this table you must define WHAT shall be exported. I decided to use a simple macro language for this purpose (see examples below). Furthermore, you should define a Title for every column in the exported file, and how a number (etc) shall be formatted for the output. The following items belong to the file definition table:
This is just a table index running from 1 to the number of lines in the table. It can be used to re-arrange the COLUMNS in the exported file. Holding the mouse pressed on the number, and move a line in this table up or down.
You must supply a name for each column here. The column titles will be written into the first line of every exported file (separated by the specified character), making it quite easy to create diagrams with Excel (etc). The title may consist of up to 20 characters.
Numeric Expression
This is a versatile way to define WHAT shall be put into a column of the exported file. Up to 80 characters for the definition are allowed. Some examples:
time  returns the current time (date+time)
noise(freq1, freq2)  calculates the noise in a frequency range
avrg(freq1, freq2)  calculates the average in a frequency range
peak_a(freq1,freq2)  calculates the peak AMPLITUDE in a frequency range
peak_f(freq1,freq2)  calculates the peak FREQUENCY in a frequency range
If you need other functions, look at these interpreter functions .  
defines how a numeric (or other) parameter shall be formatted for the text output. Some examples:
###0.#  number, one to four digits before and one digit after the point if required (non-zero)
hh:mm  formatted time+date, only hour:minute.
For an overview of formatting options, look here .  The format string may be up to 20 characters long.
The least significant bits of the "flag" value define into which of the two exported files the current line shall be active. Possible "flag" values to control this:
0 = data shall be written into both export files (only for backward compatibility !)
1 = data shall be written into the first export file ("#1") only
2 = data shall be written into the second export file ("#2") only
3 = data shall be written into both export files ("#1" + "#2").
The other "flag" bits are reserved for future applications.
 TEST #1, TEST #2
These buttons were used during program development, I didn't remove them (for future 'debugging' purposes). Clicking a button generates one line in the "exported" text format, but the result will not be written into a file. Instead, the result will be displayed in the field on the right side of the button.
"Test #1" produces an text line for the 1st export file, "Test #2" for the 2nd export file, depending on the "Flags" value.

Notes and Hints:

See also: chapter overview  

Activation and defining the Export Filenames, etc

Under Construction

The filename, activation and some more "special features" of the export function are defined one the tab "Filename & Activation" of the export definition dialog. Controls are:

See also: using two export files; interpreter commands for "export"

back to top of page

Exporting the FFT results

For some applications it was necessary to log the results from the FFT calculations for further post-processing. For this purpose, use the third tab of the export definition window. It can be opened from SpecLab's main window under "File"..."Text File Export".

In contrast to the more flexible export function for "any" numeric expressions (see previous chapter), the "FFT export function" writes the results of the main spectrum analyser into a file - preferably simple text files.

Typically, these files contain..

An example for a file created this way is given below, here: ASCII format with timestamp and compact FFT-info:

YYYY-MM-DD hh:mm:ss.s BinW_Hz F1_Hz dB_0 dB_1 dB_2 dB_3 dB_4 <<<< header
2004-06-12 14:05:29.5 1.3 47.1 -78.0 -56.7 -48.3 -52.4 -75.8 <<<< data...
2004-06-12 14:05:29.8 1.3 47.1 -82.1 -56.7 -48.8 -52.8 -73.8
2004-06-12 14:05:30.1 1.3 47.1 -83.0 -57.6 -49.5 -53.8 -79.6

(Note: the TAB separator characters could not be displayed in the HTML code)

The column titled "BinW_Hz" is the FFT bin width in Hertz, the column "F1_Hz" is the center frequency of the first exported FFT bin, also in Hertz. The titles for the FFT bins (here: in dB) have a sequence number as a suffix, because some visualisation tools want to have unique names for all data columns.

If the FFT export format is set to "ASCII/TEXT", the format of the timestamp can be defined, depending on the required resolution, and if a calendar date is required too. In the above example, a full timestamp, including date and time with a resolution of 0.1 seconds was used. This is a quite lengthy notation, other possibilities can be found in the specification of the format string for numeric values. If you leave the field "Timestamp format" empty, there will be no timestamp at all in the exported data. If there is a format string for the timestamp, it will be displayed in the header to allow automated parsing of the logged files.

Additionally, there may be a header at the beginning of every FFT logfile which makes it easier to import the data into a spreadsheet (etc) for post processing later. If you want to write your own program to analyze the data files, leave the header away to keep thing simple.

If the FFT parameters (and audio sampling rate) are never changed, leave the FFT-info away to save disk space and to simplify the file-reading routine in your program.

The FFT export file name can be entered in the export definition window. To select a simple filename, double-click into the field to open a file selector. Alternatively you can enter a string expression (instead of a fixed filename) like this:


This string expression (entered in the field "export file name") automatically produces a filename which contains the current date+time. This is especially helpful if the file size is limited, and the option "create new file when file size is exceeded" is selected.

Interpreter commands to control the export of FFTs (from the main spectrum analyser)

For special application, you may not want to export every FFT as explained above, but only if something "special" happens. For example only once per minute regardless of the waterfall scroll interval, or whenever the signal power in a certain frequency range exceeds a certain value. All this can be done with the following interpreter commands , in conjunction with the periodic or conditional actions . The token "export" can be abbreviated as "expt".

back to top of page  

Usage of the export functions

Under Construction

The text files generated by Spectrum Lab can later be used for post-processing with Excel or a similar spreadsheet program.

You will usually turn the file export on and off from the configuration dialog shown above. For very special applications, you can alternatively turn the export on and off with from SpecLab's interpreter (a kind of macro programming language).

If you want to watch the values of the exported data immediately, you can show a few exported parameters in the watch & plot window in "real time".

See also: "Applications" for SpecLab,  interpreter commands for "export" .

back to top of page

back to top of page