The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Running C++ and Matlab file together
Replies: 1   Last Post: Mar 8, 2013 8:14 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: Running C++ and Matlab file together
Posted: Mar 8, 2013 8:14 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Amarjot " <> wrote in message
> Hi,
> I have a code in two components. One components is in C++ while the
> second one is in Matlab. I run my code in c++ and then save the output in
> a folder and then run the matlab code on the putput. Is there a way to run
> the c++ code in matlab after which its output can be directly passed to
> matlab code?

There are several ways; which one is "best" depends on the specific details
of your MATLAB and C++ codes.

* Create a MEX-file from your C++ file and call the MEX-file from within
* Create an Engine application and call MATLAB from your C++ code, or
* Use the SYSTEM function inside MATLAB to invoke the application compiled
from your C++ code, or
* Use MATLAB Coder to generate C++ code from your MATLAB code and stay
completely in C++, or
* Rewrite your C++ code in MATLAB or your MATLAB code in C++ manually

There are probably a few others I haven't thought of.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.