Error in compiled exe file using deploytool ("An error occurred while trying to determine whether normcdf is a function name")

8 views (last 30 days)
I have compiled a standalone executable using deploytool.m in the Matlab Compiler Version 4.16 with Matlab R2011b. I get the following error whenever I run the compiled program (but not when I run the function from within Matlab):
"An error occurred while trying to determine whether "normcdf" is a function name"
Any ideas on why this might be occurring?
This link <http://www.mathworks.com.au/support/solutions/en/data/1-A4CIW9/index.html?product=CO&solution=1-A4CIW9> suggests that the error may be a licensing issue. If that is the case, can anyone explain that further? I have a license for the statistics toolbox (i.e., which contains normcdf). Is there a way around this error?
Thanks,
Dan

Accepted Answer

Daniel
Daniel on 9 Jan 2012
Compiling with mcc -m provides more information on the error message than contained in the log file created using the deploytool.
The full error is as follows:
"The file [Root]\toolbox\lightspeed\normcdf.m' is not in the applications expanded CTF archive at [directory]\Temp\Username\mcrCache7.16\EM_DDL1'. This is typically caused by calls to ADDPATH in your startup.m or matlabrc.m files. Please see the compiler documentation and use the ISDEPLOYED function to ensure ADDPATH commands are not executed by deployed applications.
An error occurred while trying to determine whether "normcdf" is a function name."
Removing ADDPATH calls from my startup.m file and compiling with mcc -m seems to have fixed the error.
  1 Comment
Titus Edelhofer
Titus Edelhofer on 9 Jan 2012
My advice usually is to put those addpaths in your startup file into the following conditional:
if ~isdeployed
% this is MATLAB, not compiled application
addpath(...)
end

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 9 Jan 2012
In the routine that calls normcdf, try adding
%#function normcdf
I always have a hard time finding this in the documentation. It is at http://www.mathworks.com/help/toolbox/compiler/function.html

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!