Database Toolbox    

Retrieving Elements of Query Results

For the example used in this section, the query results are assigned to the workspace variable A.

Retrieving a Single Element

To retrieve a single element from A, enclose the element's row and column numbers in curly braces. For example, to retrieve the first element, type

MATLAB returns

Retrieving an Entire Column or Row

To retrieve the data in an entire column or row, use colons within the curly braces. You then assign the results to a numeric array by enclosing them in square brackets. For example, type

MATLAB returns

You can also retrieve the contents using the celldisp function. For example, type

MATLAB returns


 Working with Cell Arrays in MATLAB Performing Functions on Cell Arrays