1. Create a Windows system ODBC data source < Open Control Panel----Administrative Tools----ODBC data source (32-bit or 64-bit)----Add a driver for----installation data source Microsoft Access Driver (MDB,ACCDB) ----Determine the name of the----data source (for example: sample; Advanced can set the user name and password, the code will be used, not set, the code is empty)----database selection (databasesample.mdb)----OK >
2. You can use the Database Toolbox (QueryBuilder) or code programming in a way that describes how to program:
(1) Connection database: Conn=database (Sample, ' username ', ' password ');
(2) The test database is connected successfully;
(3) Open cursor, execute SQL statement: CURSOR=EXEC (conn, ' select * from Databasesample ') this out can also perform SQL update (add, delete) database information;
(4) Reading data from the cursor: result=fetch (cursor) The data type of result is cell;
(5) Close cursors and Links: close (cursor); close (conn);
3. The resulting data exists in result, and the MATLAB statement is executed to obtain the data; '
Matlab Connect to an Access database