This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Ways to Import Spreadsheets

You can import data from spreadsheet files into MATLAB® interactively using the Import Tool, programmatically using import functions, or by pasting data from the clipboard.

Import Data Interactively or Programmatically

This table compares the primary ways to import spreadsheet files.

Import Option

Description

For More Information, See...

Import Tool

Import a worksheet or range to column vectors, a matrix, a cell array, a string array, or a table. You can generate code to repeat the operation on multiple similar files.

Read Spreadsheet Data Using Import Tool

readtable

Import a worksheet or range to a table.

Read Spreadsheet Data into Table

readtable with detectImportOptions function

Import data with additional control. For example, select the variables to import or handle rows with missing or error-causing data.

Define Import Options for Tables

SpreadsheetDatastore with read or readall functions

Import data from one or more worksheets in a file.

Import data from a collection of spreadsheet files.

Read Spreadsheet Data into Table

Read Collection or Sequence of Spreadsheet Files

Some import options require that your system includes Excel® for Windows®. For more information, see Supported File Formats for Import and Export.

Paste Data from Clipboard

In addition to importing data interactively and programmatically, you can paste spreadsheet data from the clipboard into MATLAB.

First, select and copy your spreadsheet data in Microsoft® Excel, then use one of the following methods:

  • On the Workspace browser title bar, click , and then select Paste.

  • Open an existing variable in the Variables editor, right-click, and then select Paste Excel Data.

  • Call uiimport -pastespecial.

See Also

| | | | |

Related Topics