Database Toolbox |
Using VQB Queries in Database Toolbox Functions
Use the Visual Query Builder to easily create a query with its graphical interface. Then copy information from the SQL statement or MATLAB command field for use with Database Toolbox functions. For more information, see Using Functions in the Database Toolbox.
Example Using VQB SQL Statement with exec Function
In the VQB, select Query -> Load and choose basic.qry
, which you created in Saving a Query. The SQL statement in the VQB contains the SQL query.
You can run the same query using Database Toolbox functions in the Command Window.
database
function. This is the equivalent of selecting the Data source in the VQB.
exec
function. This is the equivalent of selecting the Tables and Fields in the VQB. In creating the exec
statement, you can copy the content of the SQL statement from the VQB and paste it into the Command Window.
fetch
.
ans = [125970] [1400] [1100] [ 981] [212569] [2400] [1721] [1414] [389123] [1800] [1200] [ 890] [400314] [3000] [2400] [1800] [400339] [4300] [ NaN] [2600] [400345] [5000] [3500] [2800] [400455] [1200] [ 900] [ 800] [400876] [3000] [2400] [1500] [400999] [3000] [1500] [1000] [888652] [ NaN] [ 900] [ 821]
Example Using VQB MATLAB Command with insert Function
In the VQB, select Query -> Load and choose export.qry
, which you created in Exporting Data Using the VQB. The MATLAB command in the VQB contains the insert
statement.
You can run the same query using Database Toolbox functions in the Command Window.
database
function. This is the equivalent of selecting the Data source in the VQB.
insert
function. Copy the contents of the MATLAB command field from the VQB, paste it into the Command Window, change the variable name in the statement from export_data
to D
, and run the statement. This is the equivalent of assigning the MATLAB workspace variable and executing the query in the VQB.
Exporting BOOLEAN Data | Using Functions in the Database Toolbox |
© 1994-2005 The MathWorks, Inc.