Matlab Compiler is a compiler with MATLAB, it can convert m file into C, C + + or p and other types of source code, and according to the need to generate executable files, lib files (library files), DLL files or S function files. MATLAB 6.5 uses the compiler to include the MATLAB c\c++ Mathematics library function as well as the graphics library. Dynamic link library (DLL) is a commonly used technology in writing software, MATLAB provides a way to make the M file into DLL file, this article describes how to convert m file z to DLL file in MATLAB6.5, then call the DLL file in VC.
1, must ensure the correct configuration of the compiler, because the compiler used the c\c++ library functions, so before use to use
Mex-setup and
Mbuild-setup
Two commands are configured for the compiler, which is not required if you have previously configured it.
2, set the header file and library file path, you can refer to proficient VC and MATLAB joint programming < Six, configuration completed as shown in Figure 1 and Figure 2:
Figure 1
Figure 2
The reader according to MATLAB installation actual situation input header file and library file path.
3, in the Matlab Open Text Editor (file->new->m-file) to write a simple M function:
function y=huatu_test()
x=-10:0.1:10;
y=sin(x);
plot(x,y,''*'')
File is saved as HUATU_TEST.M.