User`s guide

datainsert
7-89
datainsert
Export MATLAB data into database table
To export MATLAB data into a database, use these functions: datainsert,
fastinsert, and insert. For maximum performance, use datainsert. To use
datainsert, ensure that your input data is a cell array or numeric matrix with a
specific format. When your input data is a structure, dataset array, or table, or you
are using a native ODBC database connection, use fastinsert. If datainsert or
fastinsert do not work for you and you want to insert a small set of data, use insert.
For other differences among these functions, see “Inserting Data Using the Command
Line”.
Syntax
datainsert(conn,tablename,colnames,data)
Description
datainsert(conn,tablename,colnames,data) inserts data from the MATLAB
workspace into a database table.
Examples
Export MATLAB Cell Array Data
Establish the connection conn to a MySQL database with the user name username and
password pwd. This database contains the table inventoryTable with these columns:
productNumber
Quantity
Price
inventoryDate