export

Block Category: Signal Consumer

Description: The export block writes 1 – 16 signals to an output file. The output file can subsequently be used as input to Embed or to a variety of other programs, such as MATLAB and Altair Compose. The following information is written to the file:

      Data points that represent signal values. Data points are stored as ASCII text.

      Time interval information that applies to the data points.

File formats for exported data: You can export data to CSV, DAT, M, MAT, TXT, and WAV files. The following special considerations apply to WAV files:

      If you want to create an output file to be used as input to the map block, you must specify the MAP extension.

      You can create 8-bit and 16-bit audio files. You specify the bit count in the Digits of Precision box. If you have the appropriate hardware configuration and software drivers installed, you can preview the sound by clicking Play Sound.

Header information: The header information indicates whether the data is fixed or variable interval; the valid time range over which the data is collected; the actual fixed interval; and the time column for variable interval data. The following formats are used:

Interval type

Format

Fixed

#I=start-time, end-time, increment

Variable

#T=number (time-column)

Exporting data to multiple files in multirun simulations: You can export data to multiple files using variables and activating the Auto Restart parameter in the System Properties dialog. 

Append to File: Appends the exported data to the end of a specified file, instead of re-writing the file at the start of each new simulation run. This parameter is useful for multi-run applications, such as data acquisition, Monte Carlo simulations, and neural network training.

Data File Info

Max Data Points: Indicates the maximum number of data points to be written to the export file. The default is 512 data points. The maximum number of data points that can be written to file is 250 million. When you activate Periodic Data Flush, the Max Data Points value indicates the size of the flush buffer. If you specify 0 for Max Data Points, Embed automatically calculates the buffer required by the flush interval.

Start Time /End Time: Indicate when Embed starts and stops writing data points to the export file. These settings are obtained from the current settings Start and End parameters in the System Properties dialog.

Data File Name: Specifies the name of the export file into which data points are to be written. Use Find File to locate the file. If you do not specify a file, Embed writes the data points to a file using the same name as your current block diagram, applies the DAT extension to the file, and stores it in your current directory.

You can use macros in all or part of the file specification.

For information on other file formats for exported data, see File formats for exported data.

If you click Browse Data, the file specified in Data File Name is opened in the default text editor for you to examine or edit.

Data Point Time Delta

External Trigger: Indicates that data is recorded based on the state of the external trigger input. When External Trigger is activated, Embed adds a round input connector to the export block. A 0 value on the trigger inhibits data recording. A value of 1 causes a data point to be recorded.

Valid column numbers are one through 16, inclusive.

Fixed Interval: Indicates that data points occur in fixed intervals. The default interval used will be taken from the simulation step size. You can specify a different interval, however, it should be a multiple of the simulation step size, because the export block does not interpolate. Data is only exported at integral multiples of the simulation step size. This automatic adjustment is invisible when it occurs, which means it is not reflected in either the export block’s dialog or the data file header. You can see the adjustment only when you open the data file.

If you import the output file into a simulation, you should edit the file header to reflect the interval at which the data was actually exported. The import block will interpolate as needed, retaining the timing of the original simulation run. Use the Browse Data button to open the data file in the default text editor. The format of the data header file should be as follows:

#I = start-time, end-time, increment

Digits of Precision: Specifies (for DAT, M, MAT files) the maximum number of significant digits printed regardless of the decimal point. The default is 15.

For WAV files, use Digits Of Precision to indicate whether the audio file is 8-bit or 16-bit. Enter 8 for 8-bit audio files or 16 for 16-bit audio files.

Email at Sim End: Lets you email a ZIP file containing the exported data to a list of recipients. When you activate Email at Sim End, click Config to specify the recipients. Separate multiple recipient names with semi-colons (;). You can optionally include your email address in From Addr. If you do not include your email address, the email sender is Export Block.

Enable Background Output: When Enable Background Output is activated, Embed spawns a low-priority background task to write data to the hard drive so as not to interrupt the data sampling. This parameter is particularly useful when you are performing real-time sampling of a block diagram.

Field Separator: Specifies the column separation character in the export file, which allows for compatibility with other applications. Recognized column separators are tabs, new lines, spaces, commas, semi-colons, and colons.

Header Comment: Specifies a comment that is placed at the beginning of the exported data file. A comment is limited to 180 characters.

Periodic Data Flush and Flush Interval: When activated, Periodic Data Flush writes the data in the export buffers to the specified data file at intervals established with Flush Interval. When

data is exported at the fixed interval time intervals.

When

the fixed interval is automatically recalculated to  

If you specify 0 for Max Data Points, Embed automatically calculates the buffer required by the flush interval.

Retain Trailing Zeros in Fractions: Controls whether trailing zeros are retained in fractions in the resulting file. This parameter allows columns of numbers to line up one on top of the next.

Suppress Header: Suppresses writing the data header to the export file. Suppressing the data header may be necessary if the export file is to be imported into a different software product.

Time Stamp: Produces a unique time stamp in the export file. You can control the format for displaying the date and time. You can also control whether the time stamp is put in the first or last column of the export file. It time stamps each row of data in the resulting file.

Use Comma For Decimal Point: Uses a comma as the decimal point character to support users outside North America.

Example

1. Writing data to multiple files in multi-run simulations

In this example, data is written to 11 files stored in the same directory as the diagram. 

A picture containing diagram

Description automatically generated

In the Export Filename compound block—triggered on the first pass of each simulation run—a variable is created named exportName, which expands to TestOut$runcount.TXT. Because $runCount is an integer, a decimal point is automatically used to separate the file name from the file type. The data file name for the export block is $(exportName). Use of $() instructs Embed to substitute exportName for TestOutn.TXT, where n is the run count number.