Disk writer

DiskWriter Sinks The Disk writer sink can be used to store measured data directly to disk. Data from one or more sources can be stored. Both 'normal' oscilloscope measurements and streaming measurements can be stored. When streaming measurements are stored, the newly arriving data will be appended to the previous data, forming one large block of data per stream. Data can be written in several common file formats. For more information about recording or logging data to disk, see the page about data logging.

The Disk writer sink can store streaming data directly. Do not store streaming data that is collected in a Data collector I/O using a Disk writer. Each time the Data collector receives new data, this will be signaled to the Disk writer, which will then add the complete Data collector content to the file, not just the new data.

Properties and actions

To control the behavior of the Disk writer sink, several properties are available. These can be accessed through a settings window, as shown below and through the popup menu that is shown when the Disk writer sink is right clicked in the object tree.

When the first source is connected to the writer, a settings window as depicted in the figure below will show. The settings window is also shown when clicking Show settings window in the popup menu of the Disk writer.

Disk writer

Filenames starting with

In most cases multiple files are used to save the data. The name of the files is a base filename with optional numbers appended. The base filename can be entered in the top edit box on the settings window of the Disk writer.

Serial number

When multiple files are saved, optionally a Serial number can be added to the base filename. Serial numbers starting with 0 are used. This property is default on and can only be switched off when another file identification such as a time stamp is added.

Date and time

When Date and time is checked, the date and time in millisecond precision will be added to the file name in the following format:

"YYYYMMDD_HHMMSS-MMM"

File type

The Disk writer sink can store the data in files of common File types. The File type can be set through the settings window and through the popup menu. The following file types are available:

Matlab files

Matlab .mat files can contain data from multiple sources and can contain multiple streams. In Matlab .mat files all object data is stored in separate structures, each with its 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.

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
  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.

Binary (.BIN) files

Binary files contain nothing more than raw data. No information about sample frequency, range, number of sources, number of samples etc. is included.

Data can be stored in the following Data types:

Binary file options
nameAlso 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

This file type supports multiple sources in one file. When multiple sources are included in one file, the data of the different sources is interleaved, starting with sample 0 of source 0, then sample 0 of source 1 etc.

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

The binary file only contains raw data, no information about the data is saved. When saving measured data to binary files, also save the setup to a TPS file and store that together with the BIN files. That way, the structure of the BIN files (number of sources, data type) is kept with the files and they can be read properly in a later stage.

CSV (ASCII) files

Comma Separated Values files are supported by a great number of programs. The data is stored in human readable form using ASCII characters 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 (,).

CSV Options

The exported CSV files 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 (,).

The data values can be formatted in different ways:

  • General number format: The value is converted to the shortest possible decimal string using fixed or scientific format.
  • Fixed point format: The value is converted to a string of the form "-ddd.ddd...".
  • Scientific format: The value is converted to a string of the form "-d.ddd...E+dddd".

The meaning of the precision and digits values are as follows:

Number format Precision Digits
General Number of significant digits Minimum number of digits in exponent
Fixed Number of significant digits Number of digits after the decimal point
Scientific Number of significant digits Minimum number of digits in exponent

There are some limitations when exporting data to this format. For time based 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

Wave audio files

Normally, wave files are used only for audio data, but they can also be used to store measurement data. 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 higher 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.

Wave audio options

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

All sources in one file

When the property All sources in one file is checked, the data of all sources connected to the Disk writer are written to one file. Otherwise, a separate file is created for each source. When All sources in one file is off, the source number XX starting from 1 is added to the file name. When the selected file type does not support multiple sources in one file, this property is ignored.

All streams in one file

When the property All streams in one file is checked, the sequential streams are written to one file. Otherwise, a separate file is created for each stream or data block. When All streams in one file is off, the stream number YYY starting from 0 is added to the file name. When the selected file type does not support multiple streams in one file, this property is ignored.

When the option All streams in one file is on, but for some reason a new file is started, another number is appended to the base filename. The filename will then look like this:

"D:\TestA_XX.mat",

where A is the file number, starting from 1. A new file may be started for different reasons:

  • the previous file has reached the file size limit and was closed
  • the user has clicked Close file(s) in the menu of the Disk writer.

Close file(s)

When performing measurements and All streams in one file is switched on, the Disk writer keeps the file on disk open. Other applications can not open or copy the file then. The Close file(s) action closes all open files of the Disk writer. External applications can now access the files. When new data arrives at the Disk writer, a new file will be created.

Limit file size to

By default the maximum file size is limited to 4 GiB. Because most current applications have problems handling such big files, the Disk writer has an option to limit the file size to an arbitrary number of bytes. You can set a file size limit by choosing Limit file size to in the menu of the Disk writer.

On FAT32 file systems, the maximum allowed file size is 4 GiB. On NTFS file systems, the files may be as big as the disk.

Store one of every...

By default all measurements are written to disk. It is also possible to change this behavior, such that one of every N measurements is written and the other measurements are skipped. This is done using the Store one of every... property.

To write the average of several measurements to disk, create an Average I/O and connect it to a Disk writer sink. Set the both the Averaging count and the Disk writer's Store one of every... properties to the same number. Disable the Running average setting of the Average I/O.

The Store one of every... property is available in the popup menu of the DiskWriter.

Common properties and actions

Alias

You can change the displayed name of an object by giving it an Alias. This can be handy when you are dealing with a lot of objects and have problems keeping them apart. You can for example give channel one of your instrument the alias "Battery", when it is measuring a battery voltage. To give an object an alias, use the item Alias ... in its menu. To remove an alias and revert to the original name of the object, set the alias to an empty string.

Disconnect all sources

To disconnect all sources from an I/O or Sink at once, use the Disconnect all sources action.

Clone

When a new object is to be created, similar to an already existing object, with the same properties, the Clone action can be used. This will create an identical copy of the original object, with the exact same properties. Source(s) and sink(s) of the new object are not yet connected.

Delete

The Delete action deletes a source, I/O or sink. All connections of the object will be disconnected and then the object will be removed from the object tree. The source property of the objects that used this object as source will be cleared. The sink property of the objects that used this object as sink will be cleared. An axis in a graph that was connected to this object will be also deleted.

Load

The Load action allows to load the settings and data for an object from a TPS or TPO file. This is detailed described on the page about Loading into selected objects.

Save as

The Save as action allows to save the settings and data of one or more objects to a TPO file. When multiple objects are selected, the connections between the objects are saved as well. This is detailed described on the page about Saving objects to a TPO file.