Package and class folders are not supported in app designer?

8 次查看(过去 30 天)
Should the *.mlapp files be in the MATLAB root folder or path? why app file can not be in the package and class folders such as +ui and @myapp folder?
In other words, how can we define multiple methods in separate files according to @myapp class using app designer?
writing all methods in the app designer editor is not rational in developing big applications.
Note that with exporting the mfile version from the app designer, package and class folders are supported but if any changes in the user interface be required,
the app designer drag and drop environment can not be used and adding new component should be done manually by code :((
  2 个评论
Mohammad Sami
Mohammad Sami 2020-3-16
The best work around I have found is to use app designer purely for UI. For callbacks you can just call external functions. These can then be managed as code files outside of app designer.
J. Alex Lee
J. Alex Lee 2020-3-16
+1 Mohammad's comment...but only problem is if you want your callbacks to actually be app methods, in which case you could make an app method which is a wrapper to your external function. But you still can't really control access. It's probably a moot point if your intention is to deploy as stand-alone.
Another down side of exporting as .m file is if you want to publish to a web app, I don't think it will be possible anymore.

请先登录,再进行评论。

采纳的回答

Arthur Roué
Arthur Roué 2020-3-16
编辑:Arthur Roué 2020-3-16
You can create a class folder @MyApp with the file MyApp.mlapp as constructor. Then you can create methods in separate files.
  5 个评论
Arthur Roué
Arthur Roué 2020-3-17
By default, a method in a separate will be a public one. You can change the scope by writing the function prototype in the *.mlapp in the desired section. For instance :
methods (Static)
% A static function defined in another file
[out1, out2] = ajouterAsterisque(arg1, arg2)
end
You can also defined private function in a subfolder private of your folder class.
J. Alex Lee
J. Alex Lee 2020-4-19
编辑:J. Alex Lee 2020-4-19
If you want to compile an mlapp into a web app, you need to create the web app project from the main Matlab menu; if you try to "share web" from within app designer, it will fail, I think because of the @ symbol in the class folde rname; it gives you an error about project name.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by