当前位置:网站首页>Communication mode between application program and MATLAB

Communication mode between application program and MATLAB

2022-07-07 16:03:00 notfindjob

1、mex Programming

use mex Writing can be matlab Called application module , This module does not main function , Only provided by matlab Called code . This is a kind of matlab Mode of communication , To supplement matlab Some specific functions are insufficient , You need to install the complete matlab edition .

2、RPC call (Remote Process Call) perhaps LPC call (Local Process Call)--- Online call

Call dynamically in the application matlab The interface of , The work of calculation is entrusted to matlab complete , When finished, return the results to the application . This requires opening both the application and matlab.

1) use VS2017 Build a console program (32 still 64 Need and matlab Version match for )

2) stay VS2017 In the program , add to include Contents and lib The library catalog

find matlab Installation directory , find ”MATLAB\R2016a\extern“ Catalog , take include and lib The directory is added to the console program just created .

3) stay VS2017 Write code in the console program of , Compile and pass ( Note that the application is 64 A still 32 position )

#include <engine.h>
#pragma comment(lib,"libeng.lib")
int main()
{
    Engine* pMatlab = engOpen(NULL);
    if (pMatlab == NULL) {
        printf("Open Matlab Engine error !");
        exit(-1);
    }
    else {
 

原网站

版权声明
本文为[notfindjob]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071349158290.html