interfacing matlab and c++

Posted on 2006-04-20
Last Modified: 2016-02-10
    i have done some work in both matlab and c++.i wanted to know
about some good resources on the net about interfacing and using the two together and examples of application when the two are used together.
Question by:fafa
    LVL 2

    Accepted Solution

    What do you want to do exactly? Call Matlab from C++? Or call C++ from Matlab?
    Calling C++ from Matlab can be done by generating DLL from your C++ code and use the matlab inteface to generic DLL. Or, you can write C mex files, which is a sort of wrapper/interface for Matlab types. I find Mex files a bit more tedious to deal with. On the other hand, if you have older version of matlab, this is the only option. The other option is to use COM/DDE interface.
    Calling Matlab from C++ can be done in two ways, using matlab engine or matlab compiler (extra $$).
    As for resources and examples, Matlab's own document is a good starting point.

    LVL 32

    Expert Comment

    Yes, good summary by kjpus.

    Here's a link for mex-files, because I think that is what you are asking about:
    LVL 15

    Expert Comment


    As far as I know is a "Vector" the basic data structure in MATLAB. It provides easy, fast, effective, and scalable data structures giving programming an algebraic view for data, even for complex data structures. Matlab allows you do develop fast technical solutions. However, MATLAB loops, and UIs are too slow :o. It is your responsibility to reformulate your code and data structures into matrices and vectors.

    Here's a sample on how to use MATLAB in C++:

    I hope this is what you're looking for ...
    Best regards,

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    This is about my first experience with programming Arduino.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now