Code Monkey home page Code Monkey logo

mex-file's Introduction

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

mex-file's People

Contributors

cuixing158 avatar

Stargazers

Alex_Cui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.