Database Toolbox | ![]() ![]() |
Retrieving Elements of Query Results
For the example used in this section, the query results are assigned to the workspace variable A
.
A = [12.7500] [10.1900] [52.8400]
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
A1 = A{1}
A1 = 12.75
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
AA=[A{:}]
AA = 12.7500 10.1900 52.8400
You can also retrieve the contents using the celldisp
function. For example, type
celldisp(A)
A{1} = 12.7500 A{2} = 10.1900 A{3} = 52.8400
![]() | Working with Cell Arrays in MATLAB | Performing Functions on Cell Arrays | ![]() |