Using deploytool with classdef and private functions
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Risposte (0)
Vedere anche
Categorie
Scopri di più su Function Creation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!