Package App from class FOLDER

조회 수: 4 (최근 30일)
Christian Wuerslin
Christian Wuerslin 2016년 7월 27일
답변: David Barry 2017년 11월 29일
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
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.
Christian Wuerslin
Christian Wuerslin 2016년 7월 27일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

David Barry
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.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by