| MATLAB Compiler | ![]() |
Calling Built-In Functions from C or C++
To enable a C or C++ program to call a a built-in function directly, you must write an M-file wrapper around each built-in function you wish to access outside of MATLAB. This is necessary because there are no C callable interfaces to built-in functions. For example, to use the magic function in a deployed application, you can use this M-file.
function magicsquare(n) %MAGICSQUARE generates a magic square matrix of the size specified % by the input parameter n. % Copyright 2003 The MathWorks, Inc. if (ischar(n)) n=str2num(n); end magic(n)
| Including Script Files in Deployed Applications | Calling a Function from the Command Line | ![]() |
© 1994-2005 The MathWorks, Inc.