User`s guide
Display Information About Imported Data
6-55
Display Information About Imported Data
This example shows how to import data and display information about the imported data
using a cursor object.
Alternatively, you can retrieve metadata of cursor objects by creating resultset objects
using resultset. Display information about resultset objects using rsmd. Here,
metadata refers to the information about the cursor object that contains the imported
data after running exec.
Create the Database Connection and Import Data
Create a connection conn using the dbtoolboxdemo data source.
conn = database('dbtoolboxdemo','admin','admin');
Import the first 10 rows of product description data in the column
productDescription from the table productTable.
sqlquery = 'select productDescription from productTable';
curs = exec(conn,sqlquery);
curs = fetch(curs,10);
fetch returns the imported data in the MATLAB variable curs.
Retrieve the Number of Rows in the Imported Data
Retrieve the number of rows numrows using curs.
numrows = rows(curs)
numrows =
10
Retrieve the Number of Columns in the Imported Data
Retrieve the number of columns numcols using curs.
numcols = cols(curs)
numcols =