Package and class folders are not supported in app designer?

8 views (last 30 days)
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 Comments
Mohammad Sami
Mohammad Sami on 16 Mar 2020
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 on 16 Mar 2020
+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.

Sign in to comment.

Accepted Answer

Arthur Roué
Arthur Roué on 16 Mar 2020
Edited: Arthur Roué on 16 Mar 2020
You can create a class folder @MyApp with the file MyApp.mlapp as constructor. Then you can create methods in separate files.
  5 Comments
Arthur Roué
Arthur Roué on 17 Mar 2020
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 on 19 Apr 2020
Edited: J. Alex Lee on 19 Apr 2020
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!