Home | Products | Software | Download | News | Search | F.A.Q. |        

Classroom

 

Exporting data

print

To be able to use (measured) data in other applications, data of all sources can be exported to different file types. Below you can read how to export data and you can find some information about the supported formats

How to export data

Data of all sources can be exported. This means that data of all stand-alone sources like the Software signal generator, but also outputs of other objects, like instruments and I/O's, can be saved to file.

Exporting data can be done by selecting the desired objects in the object tree and choosing "Export data..." from it's popup menu. See the picture below.

A standard save dialog will popup, which is extended with options for the selected file format. Below, the save dialog is displayed with the options for saving CSV files.

With the file type combo box, the desired file type can be selected. The list of available file types depends on the selected sources that must be saved. For example, most formats only support one time base. If sources with different time bases are selected, they will not appear in the file type list.

Binary (raw) files

Raw binary files contain nothing more than data. No information about sample frequency, range, etc. is included. Data can be stored in the following data types:

name Also known as
UINT8 Byte
INT8 ShortInt
UINT16 Word
INT16 SmallInt
UINT32 DWORD
INT32 LongInt
UINT64 -
INT64 -
FLOAT32 Single precision floating point
FLOAT64 Double precision floating point
FLOAT80 Extended precision floating point

There are some limitations when exporting data to this format. For time base signals:

  • All sources must have the same start and end time
  • All sources must have the same sample frequency
For frequency based signals (spectra):
  • All sources must have the same begin and end frequency
  • All sources must have the same data size

CSV (text) files

Comma Separated Values files are supported by a great number of programs. The data is stored in human readable form and can be viewed with any text editor. The name of the file type is a bit misleading: mostly semicolons (;) are used as column separator instead of commas (,).

The files that are written when you export data contain a header with some information and a column of data for each source. Optionally a time base and/or sample number column can be written. The columns are by default separated by a semicolon (;), but another separator may be chosen as well. The default decimal separator is a point (.), but it can be changed to a comma (,).

There are some limitations when exporting data to this format. For time base signals:

  • All sources must have the same start and end time
  • All sources must have the same sample frequency
For frequency based signals (spectra):
  • All sources must have the same begin and end frequency
  • All sources must have the same data size

Matlab files

In Matlab .mat files all object data is stored in separate structures, each with it's one time base and other information. There are three different structures that are used:

  • src : contains a single source's data
  • msrc : contains data of multiple synchronous sources
  • amsrc : contains data of multiple asynchronous sources

Time based signals, as well as frequency based signals (spectra) can be exported to Matlab .mat files. When a spectrum is saved, the PreSampleCount field is not stored, and the SampleFrequency field is replaced by the BinsPerHz field. The value of this field is expressed in Samples/Hz, similar to the SampleFrequency field, which has unit Samples/s. Both fields can be used to reconstruct the horizontal axis.

Information about the MAT-file format can be found at the MathWorks site.

[/s2]

Matlab src structure

For each selected single source or output, a src structure is written to the file. The src structure contains the following properties:

Field name Meaning
name name of the source
DateTime floating point number representing the time and date: 1 corresponds to 1-Jan-00001
RangeMin low value of the data range
RangeMax high value of the data range
SampleFrequency2 sample frequency of the data
PreSampleCount3 number of presamples in Data array
StartValue relative start time of the post samples
Unit unit of the data
Data array containing the samples

Matlab msrc structure

For each selected object with multiple synchronous outputs, a msrc structure is written to the file. An instrument is an example of an object with multiple synchronous outputs. This structure looks a lot like the src structure. The difference is that some fields are now arrays instead of single values and the field srcnames is added. The msrc structure contains the following properties:

Field name Meaning
name name of the object
srcnames names of the outputs
DateTime floating point number representing the time and date: 1 corresponds to 1-Jan-00001
RangeMin low values of the data ranges
RangeMax high values of the data ranges
SampleFrequency2 sample frequency of the data
PreSampleCount3 number of presamples in Data array
StartValue relative start time of the post samples
Unit units
Data 2 dimensional array containing the samples

Matlab amsrc structure

For each selected object with multiple asynchronous outputs, a amsrc structure is written to the file. Currently there are no objects with multiple asynchronous outputs. The msrc structure contains the following properties:

Field name Meaning
name name of the object
DateTime floating point number representing the time and date: 1 corresponds to 1-Jan-00001
srcs array containing a src structure for each output

[s1;id=foot_1">1. If the DateTime value is smaller than 50000, the file is stored with an older version of the software ( <= 1.0.3 ) and represents the number of days since 1899-12-30. In that case, add 'datenum('30-Dec-1899')' to get the correct date. Execute 'help datenum' in Matlab to find out more about DateTime.

2. For frequency based data (spectra) the SampleFrequency field is replaced by the BinsPerHz field.

3. For frequency based data (spectra) the PreSampleCount field is not present.

Wave audio files

Normally, wave files are used only for audio data, but they can also be used to store measurements. A disadvantage of wave files is that not all information can be stored. Information like measurement range and unit are lost. However, because there are a lot of wave file editors on the market, the wave file can be very convenient for editing measured data.

Most wave files contain one (mono) or two (stereo) data channels and mostly the data is stored with 8 or 16 bit precision. However, the wave file format can contain much more channels, and resolutions up to 64 bit can be used. Unfortunately, most programs that work with wave files do not support files with more than 2 channels and higher resolutions than 16 bit. Therefore, by default, the number of channels is limited to 2 and the resolution to 16 bit. The limits can be changed to write files with more channels or a highter resolution.

The wave file contains a field which contains the sample frequency of the file. For compatibility reasons, the value of the field is by default set to the standard sample frequency that is closest to the actual sample frequency. It can also be set to the original sample frequency or one of the other standard values. No resampling is performed, only the sample frequency field of the file is changed.

There are some limitations when exporting data to this format:

  • Only time based sources can be stored (no spectra)
  • All sources must have the same start and end time
  • All sources must have the same sample frequency

print