MATLAB: Error after compiling figure as exe, but running figure causes no problems

datenumdeploytoolerrorfigureguiguide

Hi.
I have created a figure in GUIDE and tested it multiple times. It works fine. However, when I use deploytool to compile an executable and I run the .exe file, I get the error message "DATENUM failed. Error in => ImportTool.m at line 42"
I have checked the ImportTool.m function. There is no datenum in line 42.
This is the initialization code:
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ImportTool_OpeningFcn, ...
'gui_OutputFcn', @ImportTool_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
Line 42 is the following:
gui_mainfcn(gui_State, varargin{:});
before the last else
Any idea what could be the problem? I guess gui_mainfcn() uses datenum and for some reason it failed… I will check again, but I am pretty sure I have not left out any of the necessary functions.

Best Answer

Okay, I found the problem. I included a function "TimeZoneConvert.m" which seems to use toolbox functions that cannot be deployed.
Related Question