Database Toolbox User's Guide
  Go to function:
    Search    Help Desk 
fetch    Examples   See Also

Import data into MATLAB cell array

Syntax

Description

cursor = fetch(cursor, rowlimit) imports rows of data from the open SQL cursor, up to the specified rowlimit, into the structure, cursor. It is common practice to reassign the variable cursor from the open SQL cursor to the structure returned by fetch. The next time you run fetch, records are imported starting with the row following rowlimit.

cursor = fetch(cursor) imports rows of data from the open SQL cursor, up to the rowlimit specified by set, into the structure, cursor. It is common practice to reassign the variable cursor from the open SQL cursor to the structure returned by fetch. The next time you run fetch, records are imported starting with the row following rowlimit. If no rowlimit was specified by set, fetch imports all remaining rows of data.

cursor.data points to the element in the structure (cell array) cursor that contains the data returned by fetch. The data types are preserved (cell arrays support mixed data types). After running fetch, display the returned data by typing cursor.data.

Use get to view properties of cursor.

Examples

Example 1 - Import all rows of data

Import all of the data into the cursor structure, cursorA:

The data is put in a cell array pointed to by the element cursorA.data of the cursor structure. To display data in the cell array cursorA.data, type:

MATLAB returns all of the data, which in this example consists of three columns and two rows:

Example 2 - Import specified number of rows of data

Specify the rowlimit argument to retrieve the first 100 rows of data:

Entering the command again returns the second 100 rows of data:

See Also

attr, cols, columnnames, exec, get, rows, set, width

[ Previous | Help Desk | Next ]