| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Database Toolbox |
| Contents | Index |
| Learn more about Database Toolbox |
This example shows how to retrieve data of types BINARY and OTHER, which may require manipulation before it can undergo MATLAB processing. To retrieve images using the SampleDB data source and a sample file that parses image data, matlabroot/toolbox/database/vqb/parsebinary.m:
For Data Operation, select Select.
In Data source, select SampleDB.
In Tables, select Employees.
In Fields, select EmployeeID and Photo (which contains bitmap images).
In the Data return format field, specify cellarray.
Click Execute to run the query.
Type A in the MATLAB Command Window to view the query results.
A =
[1] [21626x1 int8]
[2] [21626x1 int8]
[3] [21722x1 int8]
[4] [21626x1 int8]
[5] [21626x1 int8]
[6] [21626x1 int8]
[7] [21626x1 int8]
[8] [21626x1 int8]
[9] [21626x1 int8]Assign the first element in A to the variable photo.
photo = A{1,2};
Run the sample program parsebinary, which writes the retrieved data to a file, strips ODBC header information, and displays photo as a bitmap image.
cd I:\MATLABFiles\myfiles parsebinary(photo, 'BMP');
For more information on parsebinary, enter help parsebinary, or view the parsebinary M-file in the MATLAB Editor/Debugger by entering open parsebinary in the Command Window.
![]() | Fine-Tuning Queries Using Advanced Query Options | Importing and Exporting BOOLEAN Data | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |