Documentation Center

  • Trial Software
  • Product Updates

Retrieving BINARY and OTHER 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 dbtoolboxdemo 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 dbtoolboxdemo.

  3. In Tables, select Invoive.

  4. In Fields, select InvoiceNumber and Receipt (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 details about parsebinary, enter help parsebinary, or view the parsebinary file in the MATLAB Editor/Debugger by entering open parsebinary in the Command Window.

Was this topic helpful?