Hybrid programming of VC + + and MATLAB and its application

Source: Internet
Author: User
Tags mixed

This paper describes how to use Matlab to realize the design and analysis of application system in vc++6.0 compiling environment, introduces the common methods of connecting Matlab with VC application, and analyzes the steps of mixed programming of VC and MATLAB, the most The application of the above method is introduced through the realization process of a concrete example.

Keywords VC + + Matlab; Hybrid programming

Matlab by the Math Works Company in 1984, the introduction of numerical calculation and graphics processing software, can achieve numerical analysis, optimization, statistics, partial differential equation numerical solution, automatic control, signal processing, image processing and other fields of computing and graphic display functions. The set of control system Toolbox has become an effective way to design and analyze various complex control systems.

However, due to the limitations of MATLAB development platform, the program developed above can not be separated from the operating environment of MATLAB, so in dealing with some practical application problems appear to be less flexible, and VC + + to a certain extent to make up this loophole, therefore, the two are combined together, each offer its long, can be thought The scientific research work and engineering development provide more powerful technical support.

1, MATLAB and VC hybrid Programming Realization method

As a general tool of control system design, MATLAB can connect with VC conveniently. In general, MATLAB and VC hybrid programming method mainly has the following three methods: (1) through the engine (Engine), using the Client server computing mode, through the window of the ActiveX channel and MATLAB connection. Specific applications, often in VC design program framework, to compile the program as a front-end client; by invoking the MATLAB engine in the background to realize the connection with the server, the realization of dynamic communication (2) the use of MATLAB math function library, MATLAB contains a rich library of functions, But also provides a mathematical function interface with VC, users can easily in the VC IDE (integrated development environment) to call. (3) through the DLL to achieve the VC and MATLAB mixed programming. A DLL is an executable binary file. Many common functions are placed in DLLs that can be invoked by multiple applications, which is a good way to reduce the amount of external storage space and achieve code sharing [2]. In the above three methods, the first method to invoke the toolbox of MATLAB is very practical, all in the control system design and analysis, generally by invoking the MATLAB engine (Engine) to achieve. This paper mainly introduces the use of the engine (Engine) to achieve the VC and MATLAB mixed programming.

2, MATLAB engine introduction

MATLAB engine is a series of MATLAB provides a combination of programs, it allows users in their own applications to the MATLAB call, the MATLAB as an operating engine to use, so that it runs in the background. The general MATLAB engine uses the client/server (client/sever) computation way, is one kind of application processing load distributes to the client and the server's one kind of computation pattern, the client and the server can either exist in the same computer, can also realize the information sharing through the network. Typically, a client is a PC running front-end software and knows how to communicate with the server, which corresponds to a machine that receives request information and takes the appropriate line. Because the client and the server share the processing load, the overall performance of the system is greatly improved. In the actual application process, the VC C language or C + + language program as a front-end client program, it receives data from the MATLAB engine information, and the engine to pass the command data information. Table 1 is a few commonly used MATLAB engine call functions.

Table 1 MATLAB engine common call function

Through the MATLAB engine users can complete the following tasks: First of all, you can use MATLAB as a powerful and programmable mathematical function library, call MATLAB A large number of mathematical calculation functions, complete the complex computing tasks; second, you can build a complete system for a specific task, The user interface of the foreground is written in high-level language, the computing task in the background is completed by the MATLAB engine. Finally, the user can not only invoke the MATLAB engine on the local computer, but also can invoke the MATLAB engine on the other computer through the network, This can be very good to achieve the sharing of resources and operation of the division of work.

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.