User`s guide
5 Compiler Commands
Compiler Tips
In this section...
“Calling B uilt-In Functions from C or C ++” on page 5-22
“Calling a Function from the Comm and Line” on page 5-23
“Using MAT-Files in Deployed Applications” on page 5-23
“Recommended Location of .CTF Files” on page 5-23
“Compiling a GUI That Contains an ActiveX Control” on page 5-24
“Debugging MATLAB Compiler Generated Executables” on page 5-24
“Deploying Applications T hat C all the Java N ative Libraries” on page 5-25
“Locating .fig Files in Deployed Applications” on page 5-25
“Blocking Executi on of a Cons ole Appli c ation That Creates Fig ures an d
Terminating Figures by Force” on page 5 -25
“Passing Arguments to and from a Standalone Application” on page 5-27
“Using Graphical Applications in Shared Library Targets” on page 5-28
“Using the VER Function in a CompiledMATLABApplication”onpage5-28
Calling Built-In Functions from C or C++
To enable a C o r C++ program to call a built-in function directly, you must
write an M-file wrapper around each built-in function you want to access
outside of MATLAB. This is necessary because there are n o 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 m = magicsquare(n)
%MAGICSQUARE generates a magic square matrix of size specified
% by the input parameter n.
% Copyright 2003 The MathWorks, Inc.
if (ischar(n))
n=str2num(n);
end
5-22