It is possible to call MATLAB® functions, operators, user-defined functions, and other binary MEX files
from within your C/C++ source code by using the API function
sincall.c, creates an
passes various pointers to a local function to acquire data, and calls
mexCallMATLAB to calculate the
function and plot the results.
To build this example, at the command prompt type:
Run the example.
MATLAB displays a sin curve equivalent to executing the following MATLAB commands:
MAX = 1000; mm = MAX/2; for i = 1:mm-1 X(i) = i*(4*3.14159/MAX); end Y = sin(X); plot(X,Y)