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.

Working with MATLAB Interface to SQLite

To analyze your data using SQL in MATLAB® without access to a database or driver, use the MATLAB interface to SQLite. After installing Database Toolbox™, you can use the MATLAB interface to SQLite to move data between MATLAB and an SQLite database file. The SQLite connection is different from a database connection created using a JDBC driver. For background information about SQLite databases, see SQLite Home Page. To use all the Database Toolbox functionality, install the SQLite JDBC driver and connect to your SQLite database file using a URL string. For details, see Configuring Driver and Data Source.

MATLAB Interface to SQLite Advantages

The advantages of using the MATLAB interface to SQLite are:

  • Start working with data immediately after installing the Database Toolbox by creating an SQLite database file.

  • No installation or administration of software or drivers required.

  • Share data using SQLite database files.

  • Support for Windows®, Linux®, and Mac.

SQLite JDBC Connection Differences

The following table describes the differences between the MATLAB interface to SQLite and connecting to an SQLite database using the JDBC driver.

 

SQLite Connection Using the MATLAB Interface to SQLite

SQLite Database Connection Using a JDBC Driver

Driver installation

Not required

Required

Database installation

Not required

Required

Database administration

Not required

Required

Database connection function

sqlitedatabase

Import data

Yes

Yes

Export data

Yes

Yes

Database Explorer

No

Yes

Run stored procedures

No

Yes

Database metadata

No

Yes

Other complex database operations and functionality

No

Yes

MATLAB Interface to SQLite Workflow

To connect to a database quickly and import data, use the MATLAB interface to SQLite. These steps provide a high-level workflow for using the MATLAB interface to SQLite.

  1. Create an SQLite database file using sqlite. The SQLite database file has a .db extension.

  2. Create tables in the SQLite database file using exec.

  3. Export your data into the SQLite database file using insert.

  4. Import data into MATLAB using fetch.

  5. Perform data analysis in MATLAB.

  6. Export results into the SQLite database file using insert.

  7. Close the SQLite connection using close.

  8. Share the SQLite database file with others.

MATLAB Interface to SQLite Limitations

The limitations of using the MATLAB interface to SQLite are:

  • Only DOUBLE, INT64, and CHAR data types are supported.

  • NULL values in columns are not supported.

  • Database Explorer is not supported. Use the command line.

See Also

| | | |

Related Examples

More About

External Websites