Main Content

Import Data Programmatically

Import data from relational database into MATLAB® workspace using command line

Database Toolbox™ enables you to import data into MATLAB using the command line. You can import data from database tables, or write and execute SQL queries and import the results.

Objects

connectionRelational database JDBC connection
SQLImportOptionsDefine import options for database data

Functions

expand all

sqlreadImport data into MATLAB from database table
selectExecute SQL SELECT statement and import data into MATLAB
fetchImport data into MATLAB workspace from execution of SQL statement
fetchmultiImport data from SQL queries (Since R2024b)
executeSQLScriptExecute SQL script on database
runstoredprocedureCall stored procedure with and without input and output arguments
sqlinnerjoinInner join between two database tables
sqlouterjoinOuter join between two database tables
databaseImportOptionsDefine import options for database data
getoptionsRetrieve import options for database data
previewPreview eight rows from database using import options
setoptionsCustomize import options for database data
resetReset to default import options for database data

Topics

SQL Query Basics

Import Data Using Database Tables or SQL Queries