Database Toolbox    

Tutorial for Functions


Introduction

This tutorial demonstrates many of the Database Toolbox functions using simple examples.

  1. Importing Data into MATLAB from a Database.
  2. Viewing Information About the Imported Data.
  3. Exporting Data from MATLAB to a New Record in a Database.
  4. Exporting Data from MATLAB, Replacing Existing Data in a Database.
  5. Exporting Multiple Records from MATLAB.
  6. Accessing Metadata.
  7. Performing Driver Functions.
  8. Working with Cell Arrays in MATLAB.

In addition, for those who are interested in objects and methods, see About Objects and Methods for the Database Toolbox.

Examples 1 through 4 use the SampleDB data source. Instructions for setting up this data source are in Chapter 1, Installation and Setup. Examples 5 and 6 use the dbtoolboxdemo data source. Instructions for setting up this data source are in Chapter 1, Installation and Setup. Example 7 is not one you can run exactly as it is written since it relies on a specific JDBC connection and database, however, it serves as an illustration of what you can do. Example 8 shows some simple ways to work with cell arrays. Cell arrays are part of MATLAB's core functionality, but some users may not be familiar with them. Because the Database Toolbox makes use of cell arrays, some simple examples are included here.

If your version of Microsoft Access is different than that referred to in Installation and Setup, you might get different results than those presented here. If your results differ, check your version of Access and check the table and column names in your databases to see if they are the same as those used in this tutorial.

M-files containing functions used in examples 1 through 5 are in the
matlab\toolbox\database\dbdemos
directory. As you work with the examples in this chapter, you can open the M-files to see the functions and copy them, or you can run the M-files to see the results.

For more information on the functions used in this tutorial type doc followed by the function name, or see the Function Reference section.


 Other Features in Advanced Query Options About Objects and Methods for the Database Toolbox