Key Features

  • Database Explorer app for working with relational databases interactively
  • JDBC- and ODBC-compliant database connections, with fast read/write via a native ODBC interface
  • Functions for executing queries using SQL files and SQL statements
  • Data import and export with multiple databases in a single session
  • Large data set import via a single transaction, via multiple transactions, or as a DatabaseDatastore object
  • Direct data import into numeric, cell, structure, tables, and dataset arrays
  • Support for NoSQL databases MongoDB and Neo4j

Database Explorer (top) and automatically generated SQL statements (bottom).

Importing Data into MATLAB

Database Toolbox™ supports standard SQL commands, such as those used to further define data to import and retrieve from specific objects. After you import data into MATLAB®, you can view attributes of the imported data, as well as the data itself, and use MATLAB commands to process the data. Finally, you can save commands in a MATLAB program file to automate the process at a later time.

Using Scripts and Stored Procedures

With Database Toolbox, you can execute scripts and stored procedures to:

  • Execute SQL scripts directly within MATLAB and store the results for further processing
  • Call stored procedures within databases and pass parameters between MATLAB and the database
  • Retrieve data from a cursor object that contains multiple result sets

Working with Multiple Databases

Database Toolbox enables you to connect to multiple data sources within a single session and browse databases associated with each source. Within MATLAB, you can construct queries to separately retrieve selected data from each database for combined processing.

Importing Large Data Sets

Database Toolbox enables you to extract data from large data sets in a segmented and sequential manner. You can retrieve all data at once or a subset of the data. You can also easily split SQL queries, which can then be used with MATLAB Distributed Computing Server™ and parallel computing tools to parallelize access to data.

Native ODBC Driver

Database Toolbox enables you to connect to ODBC-compliant databases using a native ODBC interface. You can run queries and stored procedures, import data from the database, and export data all at once or in batches.

Database Toolbox commands that display how to import a column of data from a table.

Exporting Data to a Database

After completing calculations or data manipulation in MATLAB, you can export the results by moving data into a matrix, cell array, table, or structure, and defining the database column names to which the data is written. You can export the results as new data, or update the original data completely or conditionally.

Transacting with Supported Databases

For added security, Database Toolbox enables a transactional exchange of data with supported databases. With this feature, you can:

  • Access auto-commit functions of the underlying database
  • Make permanent changes to the database
  • Undo any changes made since the last time changes were committed or rolled back

Database Toolbox commands displaying how to export a MATLAB array into a table in the sample database. The variable stores the names of relevant columns.

Using the Database Explorer App

The Database Explorer app enables you to explore and exchange data with relational databases without any prior knowledge of SQL.

You can use the Database Explorer app to set up and manage connections to multiple databases within MATLAB. You can:

  • Select tables and columns, and create queries to import filtered data into MATLAB
  • Save queries as SQL scripts for future reference and execution
  • Generate MATLAB code to replicate particular workflows that connect to data sources and run queries

Using Database Explorer to extract data from multiple tables (bottom) and importing this data into MATLAB as an array variable (top).

Working with MongoDB

MongoDB enables you to store, query, and retrieve unstructured and structured data. In contrast to relational databases that store tables of data organized by rows, MongoDB stores data as collections of documents. This provides a sufficient structure for managing varieties of data that do not easily fit into a table format. The storage model is widely used to store social, web, and sensor data.

Accessing data from a collection of documents stored in MongoDB (bottom) using the MongoDB interface (top).

Working with Neo4j Graph Databases

Graph databases organize data as graphs, which store data in the forms of nodes, edges (or relationships), and properties. Unlike conventional relational databases, graph databases can efficiently retrieve data with complex relationships and operate on data using graph theory. Applications of graph databases are used in various fields, such as fraud detection, systemic risk modeling, social networks modeling, graph-based searches, and logistic modeling. You can access and import graph data from Neo4j directly using the MATLAB Interface to Neo4j and optionally create a MATLAB directed graph to perform graph network analysis in MATLAB.

Accessing data stored in Neo4j directly from MATLAB (top) and performing graph network analysis in MATLAB (bottom).