Products & Services Solutions Academia Support User Community Company

Learn more about Database Toolbox   

Retrieving BINARY and OTHER Sun Java Data Types

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:

  1. For Data Operation, select Select.

  2. In Data source, select SampleDB.

  3. In Tables, select Employees.

  4. In Fields, select EmployeeID and Photo (which contains bitmap images).

  5. Select Query > Preferences.

  6. In the Data return format field, specify cellarray.

  7. As the MATLAB workspace variable, specify A.

  8. Click Execute to run the query.

  9. 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]
  10. Assign the first element in A to the variable photo.

    photo = A{1,2};
    
  11. Make sure your current folder is writable.

  12. 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.

  


Recommended Products

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