Package App from class FOLDER

1 visualización (últimos 30 días)
Christian Wuerslin
Christian Wuerslin el 27 de Jul. de 2016
Respondida: David Barry el 29 de Nov. de 2017
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 comentarios
Adam
Adam el 27 de Jul. de 2016
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.
Christian Wuerslin
Christian Wuerslin el 27 de Jul. de 2016
Hi Adam,
well, I want to start the app by clicking on the app button, so matlab starts the app. And it's not a problem of dependencies, all files are there. The thing is that the installation folder of the app has to be a class folder, i.e. be called something like @MyApp/ instead of simply MyApp/ which is automatically created by the app installation.

Iniciar sesión para comentar.

Respuestas (1)

David Barry
David Barry el 29 de Nov. de 2017
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.

Categorías

Más información sobre Package and Share Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by