Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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: 17,944
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 " <amarjotsingh20@gmail.com> wrote in message
news:khc3bi$oa1$1@newscl01ah.mathworks.com...
> 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
MATLAB, or
* 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.

http://www.mathworks.com/help/matlab/external-interfaces.html

http://www.mathworks.com/help/matlab/ref/system.html

http://www.mathworks.com/products/matlab-coder/

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.