User`s guide

Compiler Tips
Passing Arguments to and from a Standalone
Application
To pass input arguments to a MATLAB C ompiler generated standalone
application, you pass them just as you would to any console-based application.
For examp le, to pass a file call ed
helpfile to the compiled function called
filename,use
filename helpfile
Topassnumbersorletters(e.g.,1,2,and3),use
filename 1 2 3
Do not separate the arguments with commas.
To pass matrices as input, us e
filename "[1 2 3]" "[4 5 6]"
You have to use the double q uotes around the input arguments if there is
a space in it. The calling syntax is similar to the
dos comm and. Fo r more
information, see the MATLAB
dos comm and.
The things you should keep in mind for your M-file before you co mpile are:
The input argume nts you pass to your from a syste m prompt are consid ere d
as string input. If, in your M-code before compilation, you are expecting
the data in different format, say double, you will need to convert the string
input to the required format. For example, you can use
str2num to convert
the string input to numerical data. You can determine at run-time whether
or not to do this by using the
isdeployed function. If your M -file expects
nume r ic in puts in MATLAB, the code can check whether it is being run as
a sta ndalone application. For example:
function myfun (n1, n2)
if (isdeployed)
n1 = str2num(n1);
n2 = str2num(n2);
end
5-27