Using Pragmas
Using feval
In standalone C and C++ modes, the pragma
%#function <function_name-list>
informs MATLAB Compiler that the specified function(s) should
be included in the compilation, whether or not the MATLAB Compiler dependency
analysis detects it. Without this pragma, the MATLAB Compiler dependency
analysis will not be able to locate and compile all M-files used in
your application. This pragma adds the top-level function as well
as all the subfunctions in the file to the compilation.
You cannot use the %#function pragma to refer
to functions that are not available in M-code.
Back to Top
Example: Using %#function
A good coding technique involves using %#function in
your code wherever you use feval statements. This
example shows how to use this technique to help MATLAB Compiler find
the appropriate files during compile time, eliminating the need to
include all the files on the command line.
function ret = mywindow(data,filterName)
%MYWINDOW Applies the window specified on the data.
%
% Get the length of the data.
N= length(data);
% List all the possible windows.
% Note the list of functions in the following function pragma is
% on a single line of code.
%#function bartlett, barthannwin, blackman, blackmanharris,
bohmanwin, chebwin, flattopwin, gausswin, hamming, hann, kaiser,
nuttallwin, parzenwin, rectwin, tukeywin, triang
window = feval(filterName,N);
% Apply the window to the data.
ret = data.*window;
Back to Top
 | Overriding Default CTF Archive Embedding Using the MCR Component
Cache | | Using mxArray |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit