Database Toolbox
Product Description
- Introduction and Key Features
- Importing Data into MATLAB®
- Exporting Data to a Database
Importing Data into MATLAB
The Database Toolbox supports standard SQL commands, including where clauses for further defining the data to be imported. The fetch statement can retrieve all data at once or a subset of the selected rows. This process can be automated if you save the commands in a MATLAB® program file. Once the data is in MATLAB, you can view attributes of the imported data, as well as the data itself, and use MATLAB commands to process the data.
Sample Code
A set of commands used to import a column of data, X, from table Y.% connect to specified database, specifying username and password connectionA = database (‘database’, ‘user’, ‘password’)% open cursor and issue SQL statement to select data cursorA = exec(connectionA, ‘select X from Y’)% retrieve R rows of data cursorA = fetch(cursorA, R)