Recently in the use of MATLAB to do the course project, involving the data additions and deletions, initially decided to use Excel as the target data file, and later for programming simple, decided to use Access to do data files.
The first thing to solve is, configure the desktop data source, My computer is WINDOWS10, so win+s, pop-up search box, enter the data source, select the corresponding 32-bit and 64-bit program, found on the Internet connection Access tutorial, not clear the selection program corresponding to the number of digits, Be sure to choose the number of bits of your computer system here.
Specific configuration:
Data source (ODBC)---"User dsn--" added. Create a data source sampledb. (select the number of digits of the computer system)
Operation of the Access database, MATLAB provides two ways,
One is to visualize the operation, enter >>querybuilder in the command window
The second is the code operation database, the specific common code is as follows:
(1) Connection database: Conn=database (SampleDB, ' username ', ' password ');
(2) Ping (conn);
(3) Open cursor, execute SQL statement: CURSOR=EXEC (conn, ' select * from time ') 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);
Connect to an Access database in the MATLAB programming environment