Creates a MatLab table variable Name with the values from a ADO or DAO recordset.


Lib.Data.Recordset("TableName") = Recordset


TableName:  (String) The Name of the MatLab table to be created..

Recordset:   (Object) The recordset object.


Note that in Office the two primary recordset objects are ADO (ActiveX Data Object) and DAO (Data Access Object).  This function will accept either object type.  Also note that recordset objects can reference most any kind of table data from Excel to SQL Server.


You can easily reference any field (column) of this table data in MatLab by using:  TableName.FieldName or TableName.("Field Name")if it has spaces in the field name.

Important Note: In order to use a Table field as data typically you will need to use the transform of the field.  As in:  TableName.FieldName'



Example: Sets the recordset either rsADO or rsDAO in Access to the table MyTable

     

Dim rsADO As New ADODB.Recordset                ' MS ActiveX data Object Library

rsADO.Open "SELECT * FROM MyTable", CurrentProject.Connection, adOpenForwardOnly, adLockOptimistic

' - or -

Dim rsDAO As DAO.Recordset                        ' MS DAO 3.6 Object Library

Set rsDAO = CurrentDb.OpenRecordset("SELECT * FROM MyTable", RecordsetTypeEnum.dbOpenForwardOnly)


Lib.Data.Recordset("MyTable") = rsADO

' - or -

Lib.Data.Recordset("MyTable") = rsDAO


In Access:


In MatLab: