Database Toolbox |
Creating and Running a Query to Import Data
Building and Executing a Query
Build and run a query to import data from your database into MATLAB. Then save the query for use again later.
Before You Start. Before using the VQB, set up a data source--see Setting Up a Data Source. The examples here use the dbtoolboxdemo
data source.
To Start. To open the VQB, in the Command Window, type
In the VQB, perform these steps to create and run a query to retrieve data:
dbtoolboxdemo
, which is the data source for the tutorial
database.
salesVolume
. Table names that include spaces appear in quotation marks. For Microsoft Excel, the Tables are Excel sheets.
StockNumber
, January
, February
, and March
. Field names that include spaces appear in quotation marks. To deselect an entry, use Ctrl+click.
A
.
A
. In the Data area, information about the query result appears.
If any of the data to be retrieved is a Java BINARY
or OTHER
type, for example, a bitmap image, the retrieval might be time intensive. For more information about retrieving this type of data, see Retrieving BINARY and OTHER Java Data.
If an error dialog box appears, the query is invalid. For example, you cannot perform a query on table and field names that contain quotation marks.
A
in the Data area. The contents of A
are displayed in the Array Editor, where you can view and edit the data. See the MATLAB Array Editor documentation for details about using it.
A
is to type A
in the Command Window.
As an example of how to read the results, sales for item 400876 are 3000 in January, 2400 in February, and 1500 in March.
Note that if the data contains the Java OTHER
data type, some fields in A
might be empty. This happens when Java cannot pass the data through the JDBC/ODBC bridge.
Help and Demos for the Visual Query Builder | Saving, Editing, Clearing Variables for, and Specifying Preferences for Queries |
© 1994-2005 The MathWorks, Inc.