Effacer les filtres
Effacer les filtres

Package and class folders are not supported in app designer?

5 vues (au cours des 30 derniers jours)
abblah abblah
abblah abblah le 15 Mar 2020
Modifié(e) : J. Alex Lee le 19 Avr 2020
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 commentaires
Mohammad Sami
Mohammad Sami le 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 le 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.

Connectez-vous pour commenter.

Réponse acceptée

Arthur Roué
Arthur Roué le 16 Mar 2020
Modifié(e) : Arthur Roué le 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 commentaires
Arthur Roué
Arthur Roué le 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)
You can also defined private function in a subfolder private of your folder class.
J. Alex Lee
J. Alex Lee le 19 Avr 2020
Modifié(e) : J. Alex Lee le 19 Avr 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.

Connectez-vous pour commenter.

Plus de réponses (0)


En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by