Database Toolbox    

Creating Cell Arrays for Exporting Data from MATLAB

To export data from MATLAB to a database (using the insert or update functions) you need to put the data in a cell array.

Enclosing Data in Curly Braces

One way to put data in a cell array is by enclosing the data in curly braces, with rows separated by semicolons and elements within a row separated by commas. For example, to insert the two rows of data A and avgA, and B and avgB, use the insert function as follows.

Assigning Cell Array Elements

Put data into a cell array element by enclosing it in curly braces. For example, if you have one row containing two values you want to export, A and meanA, put them in cell array exdata, which you will export, by typing

To export the data exdata, use the insert function as follows.

Converting a Numeric Array to a Cell Array

To export an entire numeric array to a cell array, use the num2cell function. For example, to convert the numeric array monthly to a cell array exdata, type

num2cell takes the data in monthly and assigns each row to a row in a new cell array, exdata, which you can then export to your database.


 Performing Functions on Cell Arrays Reference