The MATLAB toolbox function is invoked in C++builder, and there are two ways to implement it. One is based on the MATLAB environment support, through the necessary settings to achieve; The author has written a special exposition of this way in this newspaper. The other is completely out of the MATLAB environment, through the dynamic Connection Library way to achieve the MATLAB toolbox function calls, this can be achieved through a development platform Mediva. Relatively speaking, the former has more restrictive factors, while the latter is more convenient and flexible.
First, Mediva software platform
Mediva is a mathtools company launched a MATLAB software platform for the development of MATLAB program files (m file) to explain the implementation and development of environmental support. The software has different versions developed for Borland C + +, Visual Basic and Dephi programming languages, and is now in its 4.5 version. Software size is only 6.5M and can be downloaded for one months by visiting its site www.mathtools.com for free. Mediva software platform itself is very powerful, provide nearly thousands of basic functions of MATLAB, through the necessary settings, you can directly realize the mixed programming with C + +, and no longer rely on the MATLAB, while the Mediva also provides the compiler conversion function, can be MATLAB function or written MATLAB program into C + + form of the DLL, so as to achieve the MATLAB from the environment of the function and process of the effective invocation of MATLAB, so it is possible to achieve the powerful toolbox of MATLAB use of the function.
Mediva's disadvantage is that C + + and MATLAB mixed application software must carry the necessary DLLs, thereby increasing the volume of the software (about 4M), but also can not provide support for all MATLAB functions, such as the use of class library to design part of the function. However, Mediva is still a good tool for the computer design and analysis of the control system.
Since the use of Mediva to convert MATLAB toolbox functions into DLLs is more content, limited to space in this article only gives the realization of direct call to Matlab function, and will write another article on the implementation of DLL.
Second, C++builder directly call the MATLAB function
This article assumes that the Mediva software has been installed or that the necessary two dynamic connection libraries Mdv4300.dll and Ago4300.dll have been obtained.
Mediva provides nearly thousands of basic functions of MATLAB, can be called directly in the C++builder. These functions include basic operations, commands, I/O, linear algebra, bitmaps, control, and so on, and can basically meet our general needs. Of course, its biggest advantage is that you can directly in the C++buider direct call without considering the installation of large MATLAB.
Its implementation methods and steps are as follows:
1. Generation of LIB file
In DOS, use the Implib.exe in C++builder to generate Mdv4300.lib:implib mdv4300.lib through the following command Mdv4300.dll
Copy the two DLL files and the Lib file to the current directory.