User`s guide

7 Functions — Alphabetical List
7-226
setdbprefs('DataReturnFormat','structure')
Import data into the MATLAB workspace.
curs = exec(conn,...
'select productnumber,productdescription from producttable');
curs = fetch(curs,3);
curs.Data
ans =
productnumber: [3x1 double]
productdescription: {3x1 cell}
Resulting data displays as a structure.
View the contents of the structure curs.Data to see the data.
curs.Data.productdescription
curs.Data.productnumber
ans =
'Victorian Doll'
'Train Set'
'Engine Kit'
ans =
9
8
7
Close the connection.
close(conn)
Change the Write Format for NULL Numbers
Changing the write format for NULL numbers allows the insertion of a NaN as a NULL in
the database.
Establish connection conn to a MySQL database with user name username and
password pwd. This database contains the table inventoryTable with these columns:
productNumber, Quantity, Price, and inventoryDate.