VC + MATLAB Mixed Programming Experience Summary

xiaoxiao2021-03-06  105

People who have used Matlab will amaten it in numerical treatment and drawing, can usually use it or feel difficult. Can you use Matlab to make a general user to operate, the interface is simple and friendly program? This article is trying to compile MATLAB's M files into a mixed programming method that makes VC calls. The procedure thus obtained has several benefits: 1. Can be running out of the MATLAB environment; 2. The rapid use of VC's procedures, and convenient user use. Here's a brief introduction to the process of a procedure I do in this regard.

1. Enter MEX -SETUP in the MATLAB command line window, and then select VC6 according to prompt after entering confirmation;

2. Enter MBUILD -SETUP in the MATLAB command line window, and then select VC6 according to the prompt after entering confirmation;

3. Finally, enter the CD (PrefDir) and mccsavePath commands, and the relevant settings in this MATLAB have been completed;

4. Open VC, in Tools-Customize-Add-Ins and Macro File, will see Matlab Add-Ins appear. Select it;

5. The MATLAB Project Wizard option appears in File-New-Projects, select it, creates a MATLAB Project program based on the wizard, pay attention to select Shard M-DLL in the Visual Matlab Application Type group, because we have to compile Matlab The m file is DLL;

6. At this point, the settings in the VC have been completed. Click the Add m-Files to Current Project button on the toolbar to compile the M file to the VC program call from the DLL supply. If it is a graphics, there is a bin subfolder under the folder where the program is located, where there is two files that figuremenubar.fig and figuretoolbar.fig, which can be seen from the name, including their graphics window interface, has a menu and toolbar. Copy the folder and the DLL file, the lib file, and the header file to the VC program that calls them in the middle.

7. Finally, there is a precaution when packaged, and the program is really completely out of the MATLAB environment, and many of the MATLAB library files must be packaged. Mglinstaller.exe in the extern / lib / win32 subdirectory in the MATLAB installation directory. Run the program to automatically extract the required library functions into the current directory.

转载请注明原文地址:https://www.9cbs.com/read-96933.html

New Post(0)