Package App from class FOLDER
1 次查看(过去 30 天)
显示 更早的评论
The matlab app documentation states that classes are a good choice for an app backbone (to which I agree). I guess that packaging an app from a single class file is straight-forward. However, when I'm trying to package an app from a class folder (i.e. of the form @MyApp/MyApp.m and then all the class methods as separate files in the same folder), stuff goes sideways. When choosing the main file in the app packaging dialog, I cannot chose the folder, so I chose the file containing the class interface and the constructor (i.e. MyApp.m). So when I package the app and all it's dependencies, then install it, the app gets installed into a normal folder, rather than a class folder, so trying to start the app results in not finding the implementation of the class methods. Does anyone know how to package an app from a class folder, or if this is supported at all? Am I overlooking something? My version is 2014b, though I don't think that this makes a difference. Any help appreciated.
Christian
2 个评论
Adam
2016-7-27
Unless I am missing something you must have some kind of standalone function that kicks off your app?
I've never tried packaging up with a class as the top level file - I guess if its constructor takes 0 arguments then it works as an entry point though.
Usually, wether I am using GUIDE or a programmatic UI I write a small wrapper function to launch it and this is what I then give to the compiler for it to determine the dependencies and include them as necessary.
回答(1 个)
David Barry
2017-11-29
Your main file should really be a function and must be called with no input arguments. It must return a figure handle so the app system can tidy up the path when the app is closed. The launcher function could simply just construct your main class and return a figure handle.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Package and Share Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!