User`s guide

6 Using Database Toolbox Functions
6-32
Retrieve Image Data Types
This example retrieves images from the dbtoolboxdemo data source using a sample file
that parses image data, matlabroot/toolbox/database/vqb/parsebinary.m.
1
Connect to the dbtoolboxdemo data source.
conn = database('dbtoolboxdemo','','');
Alternatively, you can use the native ODBC interface for an ODBC connection. For
details, see database.
2
Specify cellarray as the data return format preference.
setdbprefs('DataReturnFormat','cellarray')
3
Import the InvoiceNumber and Receipt columns of data from the invoice table.
curs = exec(conn,'select InvoiceNumber, Receipt from Invoice')
curs = fetch(curs);
4
View the imported data.
curs.Data
ans =
[ 2101] [1948410x1 int8]
[ 3546] [2059994x1 int8]
[ 33116] [ 487034x1 int8]
[ 34155] [2059994x1 int8]
[ 34267] [2454554x1 int8]
[ 37197] [1926362x1 int8]
[ 37281] [2403674x1 int8]
[ 41011] [1920474x1 int8]
[ 61178] [2378330x1 int8]
[ 62145] [ 492314x1 int8]
[456789] []
[987654] []
Note: Some OTHER data type fields may be empty, indicating that the data could not
pass through the JDBC/ODBC bridge.
5
Assign the image element you want to the variable receipt.