Data Import Wizard

The Data Import Wizard is more flexible and accepts more file types than the File Input Component, although it requires you to fill in more information to import a file to precise specifications. The Data Import Wizard also allows you to interactively preview your data, so that any changed import settings are automatically reflected in the Wizard.

To insert the component:

  1. Choose Component from the Insert menu.
  2. Choose Data Import Wizard from the resulting list.
  3. Choose a type and location for your data file, and fill in the information on subsequent panes.
  4. When you are done, enter the array variable name containing your data in the placeholder that appears at the left of the component.

The output of this component can be manipulated like any other Mathcad array. The Wizard establishes an updatable connection to a data file: if you recalculate the region, the file is imported again. If you only wish to import data once, use a Data Table.

There are a number of tabs available on the Wizard. The available choices depend on the type of file you are importing.

File Format Dialog

The first dialog in the Data Wizard sequence allows you to select the location and format of your file, determining the choices available on subsequent panes, and the way the component displays in the worksheet. The following options are available:

File Format

Allows you to select the type of file you wish to read. Available options are Delimited Text, Fixed-Width text, Microsoft Excel, MATLAB, Binary, Mathcad PRN, and several other database options.

File Name

Allows you specify the name and path to your file, either by typing it in the entry box or by using the Browse button. There is also a check box for selecting relative or absolute path.

Display as icon

By default, data files imported using the Data Wizard display as data tables, showing their contents. Checking this box displays only the file name and associated path.

Delimited Text Options

The Delimited Text Options tab is only available when importing data from a delimited text file. Only the first 100 rows are displayed in the preview, for speed. This tab contains the following options:

Delimiters

Allows you to specify the type of delimiters to recognize when reading the file. Choices are: Auto, tab, space, comma, and other, allowing you to enter any text value(s).

Starting row

Allows you to select the first row from which you wish to read the data.

Blank rows

Allows you to select how you would like to treat blank rows: by skipping them, by reading them as blanks in the data, or by stopping the data import.

Footer rows

Allows you to select a number of rows to omit from the end of the file.

Fixed-Width Text Options

The Fixed-Width Text Options tab is only available when importing data from a file with fixed-width columns. Only the first 100 rows are displayed in the preview, for speed. This tab contains the following options:

Column Widths

Allows you to specify the number of characters in each column of fixed-width data. Column widths should be separated by a comma, and there should be an equal number of widths and columns in your file.

Starting row

Allows you to select the first row from which you wish to read the data.

Blank rows

Allows you to select how you would like to treat blank rows: by skipping them, by reading them as blanks in the data, or by stopping the data import.

Text Options tab

The Text Options tab controls how the Data Import Wizard processes text files imported into Mathcad, and contains the following options:

Text qualifier

Allows you to specify a qualifying character to override the Wizard's auto-sensing to determine which entities are read as text.

Thousands separator

In files which contain thousands separators, allows you to choose between comma, dot, and space to correctly interpret the represented numbers.

Decimal symbol

Allows you to choose between comma and dot as a decimal symbol, to correctly interpret the represented numbers.

Missing value

Tells Mathcad the substitution to make when it encounters missing data. Since Mathcad cannot calculate arrays containing an empty placeholder, you must make sure all placeholders are filled. You can choose to fill empty cells with NaN, 0, -1, or an empty (null) string, or enter a different value.

Binary Options tab

The Binary Options tab is only available when you use the control to import a binary format file. Only the first 100 rows are displayed in the preview, for speed. This tab contains the following options:

Data Type

Select one of the following options: unsigned 8-bit integer (byte), 64-bit floating point (double), 32-bit floating point (float), 16-bit integer (int16), 32-bit integer (int32), unsigned 16-bit integer (uint16), or unsigned 32-bit integer (uint32).

Endian

Choose whether data is interpreted as little-endian (low byte first) or big-endian (high byte first). It has no effect if you select byte as the data type.

Number of Columns

Set the number of columns per row in which to format the data; the minimum acceptable value is 1. Incomplete rows are ignored.

Skip

Number of bytes to skip before reading.

Excel Options tab

The Excel Options tab is only available when importing data from an Excel file. Only the first 100 rows are displayed in the preview, for speed. This tab contains the following options:

Named range

Allows you to select a block of data by specifying the named range associated with it. The Wizard can access any named range in the workbook.

Blank rows

Sets how the control handles empty rows in the data set. You can choose to skip them, read them, or stop at the first one reached.

Worksheet

Allows you to select the specific page in the workbook from which to import data. If no worksheet or named range is selected, the control reads data from the first page of the workbook.

Missing value

Tells Mathcad the substitution to make when reading in an empty cell. Since Mathcad cannot calculate arrays containing an empty placeholder, you must make sure all placeholders are filled. You can choose to fill empty cells with NaN, 0, -1, or an empty (null) string, or enter a different value.

Range

Allows you to specify the particular range of cells to read in; by default, the Wizard reads in all data on the default worksheet. You can specify the particular cells to read by using the Excel syntax

[Worksheet name]![Start cell]:[End cell]

You can also use the data preview to specify the range by shift- or control-clicking the specific rows or columns you wish to import. You can select all the cells by clicking the empty box in the upper left corner of the data preview.

Data Range tab

The Data Range tab allows you to specify the rows and columns to import. It is the last tab in the Wizard, and applies to all file types. You can either do this visually, by selecting the row and column headings in the preview, or in the available text boxes, if you want to specify rows and columns by number. For example, you could Ctrl-click to select discontiguous rows, or you could type 1-3,5,7-9 in the Read Rows text box.

The preview on this tab is limited to the first 250,000 data points, for the sake of speed.

Notes:

QuickSheet

Related Topics