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

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

Database Toolbox™ lets you 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.

Apps

Database Explorer Configure, explore, and import database data

Using Objects

connection Relational database connection
sqlite SQLite connection
cursor Database cursor

Functions

select Execute SQL SELECT statement and import data into MATLAB
exec Execute SQL statement and open cursor
fetch Import data into MATLAB workspace from database cursor or from execution of SQL statement
fetchmulti Import data from multiple resultsets
runsqlscript Run SQL script on database
runstoredprocedure Call stored procedure with and without input and output arguments
attr Retrieve attributes of columns in fetched data set
cols Retrieve number of columns in fetched data set
columnnames Retrieve names of columns in fetched data set
get (To be removed) Retrieve object properties
querytimeout Get time specified for SQL queries to succeed
rows Return number of rows in fetched data set
set (To be removed) Set properties for database or cursor object
width Return field size of column in fetched data set

Topics

SQL Query Basics

Data Import Using Database Explorer App or Command Line

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

Command Line

Data Import Approaches and Memory Management

Save memory when importing data using functions, limiting the number of rows, or specifying database preferences.

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.

Was this topic helpful?