| Database Toolbox | ![]() |
Viewing Information About the Imported Data
In this example, you view information about the data you imported and close the connection. You learn to use these Database Toolbox functions:
If you want to see or copy the functions for this example, or if you want to run the set of functions, use the M-file matlab\toolbox\database\dbdemos\dbinfodemo.m:
conn = database('SampleDB', '', ''); curs = exec(conn, 'select country from customers'); setdbprefs('DataReturnFormat','cellarray'); curs = fetch(curs, 10);
columnnames returns the names of the columns in the data set. This example has only one column and, therefore, only one column name, 'country', is returned.
width returns the column width for the column number you specify. Here, the width of column 1 is 15.
attributes = fieldName: 'country' typeName: 'VARCHAR' typeValue: 12 columnWidth: 15 precision: [] scale: [] currency: 'false' readOnly: 'false' nullable: 'true' Message: []
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.
| Importing Data into MATLAB from a Database | Exporting Data from MATLAB to a New Record in a Database | ![]() |
© 1994-2005 The MathWorks, Inc.