Using deploytool with classdef and private functions

Hi (I use MATLAB 2014a on a Windows7).
I am trying to use deploytool to compile a standalone .exe for a custom class I have defined using classdef. However, I have ran into a problem if this class uses functions stored in a private subfolder of the class. If I do this, I get no error message during packaging, and it seems to be including the file as it should (e.g. it is added to included files and it is not showing up in the mccExcludedFiles log). But when I try to run the .exe it says: "Undefined function 'createMyTestApp' for input arguments of type 'TestApp'. Error in => TestApp.m at line 10 [OK]"
I ran some tests creating a simple class as shown below. If I move the createMyTestApp.m file to some other folder which is not a subfolder of @TestApp, and include it, it works. But as soon as it is placed in the "private" subfolder of @TestApp it does not work. (In both cases I can get it to work in the MATLAB runtime enviornment before packaging it.
Example code:
classdef TestApp < handle
properties
FHandle = nan;
end %properties
methods
% Constructor
function obj = TestApp()
obj = createMyTestApp(obj, 'Hello world', 'Welcome');
end
end %methods
end
Then in a seperate file which I would like to place in a "private" subfolder of @TestApp,
function obj = createMyTestApp(obj, title, text)
% Figure
obj.FHandle = msgbox(text, title);
I can also get it to work if I place createMyTestApp inside the TestApp file, assuming I modify the function call on line 10 to:
obj = createMyTestApp('Hello world', 'Welcome');
But my final class is more complicated than this test class, and I would prefer placing its private functions in a private subfolder. For the same reason I would also like to avoid having them located some other "random" place other than a subfolder of the class they belong to.
Cheers Jensen

댓글 수: 1

Dail
Dail 2016년 10월 28일
have you ever solved this problem? I am also facing this problem=_=

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

질문:

2014년 12월 4일

댓글:

2016년 10월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by