Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Import Tool

Import data from file

Description

The Import Tool lets you preview and import data from spreadsheet files, delimited text files, and fixed-width text files. You can interactively select the data to import and reuse the script or function that the tool generates to import other similar files.

Open the Import Tool App

  • MATLAB® Toolstrip: On the Home tab, in the Variable section, click Import Data.

  • MATLAB command prompt: Enter uiimport(filename), where filename is a character vector specifying the name of a text or spreadsheet file.

Examples

expand all

Import ranges of data from a tab-delimited text file and replace nonnumeric values in the file.

Drag the cursor to select the cells to import. Press Ctrl to select noncontiguous ranges.

Modify the Variable Names Row field to indicate the row you want the Import Tool to use for the variable names.

By default, NaN replaces unimportable values in numeric cells. However, you can change this value to any other numeric value. Specify how to treat unimportable values on the Import tab, in the Unimportable Cells section.

Alternatively, exclude any row that contains an unimportable cell from being imported.

Click Import Selection . The new column vectors appear in your workspace.

Import dates and numbers from a text file into a table. Specify the decimal separator for numeric values in the file and a custom format for dates.

In the Imported Data section, select Table to import the file data into a table variable. In this example, the third column of data contains monetary amounts where the decimal separator is a comma. In the Delimiters section, select Delimiter Options. Then, under Decimal Separator, select , (comma).

The Import Tool appropriately converts the monetary values.

Specify that a column contains date or time data by changing the data type for the column to DATE/TIME. Click more date formats.... Scroll down the list to enter a custom date format.

Click Import Selection to import the table.

Related Examples

Programmatic Use

Limitations

  • On Linux® platforms, Import Tool cannot open spreadsheet files written by the writetable function.

See Also

Functions

Was this topic helpful?