Database Toolbox    

Viewing Information About the Imported Data

In this part of the tutorial, you view information about the data you imported and close the connection. You use these Database Toolbox functions:

If you want to see or copy the functions for this part of the tutorial, or if you want to run the set of functions, use the M-file matlab\toolbox\database\dbdemos\dbinfodemo.m.

  1. If you are continuing directly from the previous part of the tutorial, skip this step. Otherwise, if the cursor and connection are not open, type the following to continue with this tutorial.
  2. View the number of rows in the data set you imported - type

    MATLAB returns

    rows returns the number of rows in the data set, which is 10 in this example.

  1. View the number of columns in the data set - type

    MATLAB returns

    cols returns the number of columns in the data set, which is one in this example.

  1. View the column names for the columns in the data set - type

    MATLAB returns

    columnnames returns the names of the columns in the data set. In this example, there is only one column, and therefore only one column name, 'country', is returned.

  1. View the width of the column (size of field) in the data set - type

    MATLAB returns

    width returns the column width for the column number you specify. Here, the width of column 1 is 15.

  1. You can use a single function to view multiple attributes for a column - type

    MATLAB returns

    Note that if you had imported multiple columns, you could include a colnum argument to specify the number of the column for which you want the information.

  1. Close the cursor - type

    Always close a cursor when you are finished with it to avoid using memory unnecessarily and to ensure there are enough available cursors for other users.

  1. At this point, you can go to the next part of the tutorial. If you want to stop working on the tutorial now and resume with the next part at a later time, close the connection. Type

 Importing Data into MATLAB from a Database Exporting Data from MATLAB to a New Record in a Database