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 Data into MATLAB Workspace

Import data into MATLAB® workspace using Database Explorer app or command line

Database Toolbox™ enables you to create SQL queries by building them visually using the Database Explorer app or by writing them using SQL. To import data into the MATLAB workspace, run a SQL query and import the data.


Database ExplorerConfigure, explore, and import database data

Using Objects

connectionRelational database connection
sqliteSQLite connection
cursorDatabase cursor


selectExecute SQL SELECT statement and import data into MATLAB
execExecute SQL statement and open cursor
fetchImport data into MATLAB workspace from database cursor or from execution of SQL statement
fetchmultiImport data from multiple result sets
runsqlscriptRun SQL script on database
runstoredprocedureCall stored procedure with and without input and output arguments
attrRetrieve attributes of columns in fetched data set
colsRetrieve number of columns in fetched data set
columnnamesRetrieve names of columns in fetched data set
get(To be removed) Retrieve object properties
querytimeoutGet time specified for SQL queries to succeed
rowsReturn number of rows in fetched data set
set(To be removed) Set properties for database or cursor object
widthReturn field size of column in fetched data set


SQL Query Basics

Data Import Using Database Explorer App or Command Line

Decide the best way to import data from your database into MATLAB.

Database Explorer App

Create SQL Queries Using Database Explorer App

Create SQL queries in the same database, different catalogs or schemas, or different databases.

Command Line

Data Import Approaches and Memory Management

Save memory when importing data using functions and limiting the number of rows.

Import Data from Databases into MATLAB

Write simple and more complex SQL queries for importing data into MATLAB.

Using Scrollable Cursors

Learn about scrollable cursors and how they behave with different drivers.

Call Stored Procedure That Returns Data

Define stored procedures in a database and call them using the exec function.

Display Information About Imported Data

Explore the structure and attributes of imported data using a cursor object.

Working with MATLAB Interface to SQLite

Analyze data without access to a database or driver by using the MATLAB interface to SQLite.

Related Information

Was this topic helpful?