I have 2 separate functions which one is in MS visual C++ and another is in Matlab. How do I execute the Matlab file in MS VISUAL? Is there a windows function to load the .m
file and execute it straightly?
Asked
Active
Viewed 2,714 times
1

herohuyongtao
- 49,413
- 29
- 133
- 174

user3396218
- 255
- 2
- 8
- 20
-
You would typically use the matlab compiler to make a DLL that can be consumed by your program. – David Heffernan Apr 14 '14 at 13:58
-
i see! Is the process very tedious? – user3396218 Apr 14 '14 at 14:03
-
last question. If i have the matlab compiler to make it into DLL, do i still need the Matlab installed on a computer for the VC++ to run the DLL? – user3396218 Apr 14 '14 at 14:11
-
You need the target machine to have the MATLAB compiler runtime. It's documented clearly in the MATLAB docs – David Heffernan Apr 14 '14 at 14:14
1 Answers
2
Two ways to run Matlab code in C++:
Call MATLAB Engine directly.
The target machine needs to have the MATLAB installed. Check out Call MATLAB Functions from C and C++ Applications for more info and examples.
Distribute MATLAB code into independent shared library (dlls).
The target machine needs to have the MATLAB compiler runtime. Check out here on how to do this (with detail steps and example).

Community
- 1
- 1

herohuyongtao
- 49,413
- 29
- 133
- 174