Database Toolbox |
Viewing Elements of Cell Array Data
In these examples, the curs.Data
notation is not used and instead the examples assume you assigned curs.Data
to a variable. If you do not assign curs.Data
to a variable, then just substitute curs.Data
for the variable name in the examples.
This example is the same as that in Exporting Data from MATLAB to a New Record in a Database, but the DataReturnFormat
is set to cellarray
.
Viewing a Single Element as a Numeric Value
To view the first element of A
, type
The brackets result is not numeric but instead is an element in a cell array. You cannot perform numeric operations on cell array data.
To retrieve the first element as a numeric value, enclose it in curly braces. For example, type
This result is numeric and, therefore, you can perform numeric operations on it.
Viewing an Entire Column or Row as a Numeric Vector
To retrieve the data in an entire column or row of a cell array as a numeric vector, use colons within the curly braces. You then assign the results to a matrix by enclosing them in square brackets. For example, to retrieve all the data in column 1, type
You can also retrieve the contents using the celldisp
function. For example, type
Working with Cell Arrays in MATLAB | Performing Functions on Cell Array Data |
© 1994-2005 The MathWorks, Inc.