mex-file-code-generation

版本 0.0.1 (51.6 KB) 作者: cui,xingxing
MATLAB MEX file For C/C++ code generation
24.0 次下载
更新时间 2023/8/12

MATLAB MEX file For C/C++ code generation

View mex-file-code-generation on File Exchange

Open in MATLAB Online

logo

OverView

In order to call external C/C++ library functions, it is generally recommended to use the mex built-in function to compile the source code into a mex executable file, but the disadvantage is that it is not easy to generate C/C++ code in turn if there are other matlab code mixed in. This example is just to show how to use codegen two-way through this process, not limited to the example itself, is a general method, another advantage is not limited to the code generation of various restrictions, fully integrated with C/C++ programming.

Requirements

How to setup

1.Configuring the compiler

In the command window,configure your complier.

mex -setup C++ 

2.Source Code Preparation

Prepare your C/C++ code and MATLAB entry-point function.Prepare the implementation of the updateBuildInfo(buildInfo, buildContext) member function, rewritten according to the path of the external library. (header files and library files).

3.Generate or Compile

Generate or compile the files you want with the codegen command. For example:

imagePath = "./test_480x640x3.jpg";
input1 = coder.typeof(imagePath);
input1.StringLength=inf;
codegen -config:mex imread_opencv -args {input1}  -lang:c++ -report

引用格式

cui,xingxing (2024). mex-file-code-generation (https://github.com/cuixing158/mex-file/releases/tag/v0.0.1), GitHub. 检索来源 .

MATLAB 版本兼容性
创建方式 R2023a
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
0.0.1

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库