Database Toolbox    

Performing Functions on Cell Arrays

To perform MATLAB functions directly on cell arrays, you need to extract the contents of the cell array by enclosing the elements in curly braces. For example, to compute the sum of the elements in the cell array A, type

Because sum only works on numeric arrays, you convert the contents of A{:} to a numeric array by enclosing it in square brackets.

Getting the Size of an Array

If you want to perform functions that use the number of rows or columns in the query results, use the size function to get the information. In this example, get the size of workspace variable A, which contains the query results, and assign the number of rows and columns in A to m and n respectively. Type


 Retrieving Elements of Query Results Creating Cell Arrays for Exporting Data from MATLAB