MATLAB database toolbox Functions

Source: Internet
Author: User

After reading the database function book, I still don't feel like configuring the data source and setting it.

Enhance Point-to-Function Memory and usage.


After the data source is configured

Conna = database ('cename', 'A', 'B') ----------- your data source name. The following parameters A and B are generally empty strings;

In some cases, to prevent the database from being connected to MATLAB, we can set up a time limit, that is, the logintimeout function,

Logintimeout (T). If the time is greater than T and the MATLAB cannot be connected, the connection is stopped;

Therefore, Ping (Conna) to check whether the connection is successful,

Then, you generally need to create a cursor,

Curs = exct (Conna, 'SQL') -------- the ecxt function is used to execute SQL statements. The returned cursor is used. In fact, I am not clear about these terms, so it is very rough to understand that through the exct get curs know, at this time the operation position.

After you get curs successfully,

Curs1 = fetch (curs );

Note that the two curse attributes are different. The most basic thing I remember is that the curs IN THE RIGHT brackets do not have data, curs1 can obtain the corresponding cellular information (I don't know if I can understand it ).

Therefore, curs1.data is the corresponding meta-cell information output, but curs. Data should not work. (Not tried ).

Of course, if you need to add data to the database

Insert (Conna, 'name', columaname, data) ------ it is easy to understand that data is input in certain columns of a database named name.

Of course, to ensure timely data updates, commit (Conna), think of the previous exct,

Therefore, commit (Conna) = exct (Conna, 'commit ')

At this point, the most basic thing should be that it can be imported to Matlab,

The final work is close (curs1) and close (Conna ).


Of course, there are still a lot of practical functions in this process, such as rows, cols, columename, width and other basic information, which is conducive to a variety of changes, convenient and flexible use.


PS. Today I met a new function. It's quite good. Record inputdlg.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.