Database Toolbox | ![]() ![]() |
Building, Running, and Saving a Query
Topics covered in this section are:
Building and Running a Query
Build and run a query to import data from your database into MATLAB. Then save the query for use again later.
dbtoolboxdemo
, which is the data source for the tutorial
database.The list includes all data sources you set up. If you do not see the data source you want to use, you need to add it - see Setting Up a Data Source in Chapter 1.
After selecting a data source, the list of tables in that data source appears.
salesVolume
.StockNumber
, January
, February
, and March
.A
.The query runs, retrieves data, and stores it in a MATLAB cell array, which in this example is assigned to the variable A
. In the Data area, information about the query result appears.
A
in the Data section. The contents of A
is displayed in the Command Window. Another way to see the contents of 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.
![]() | Starting and Quitting the Visual Query Builder | NULL Values | ![]() |