MATLAB Creating Graphical User Interfaces

(Barry) #1

16 Packaging GUIs as Apps


In addition when others install your app:


  • It is a one-click installation.

  • Users do not need to manage the MATLAB search path or other installation details.

  • Your app appears alongside MATLAB toolbox apps in the apps gallery.


Best Practices and Requirements for Creating an App


Best practices:


  • Write the app as an interactive application with a user interface written in the
    MATLAB language.

  • All interaction with the app is through the user interface.

  • Make the app reusable. Do not make it necessary for a user restart the app to use
    different data or inputs with it.

  • Ensure the main function returns the handle of the main figure. (The main function
    created by GUIDE returns the figure handle by default.)


Although not a requirement, doing so enables MATLAB to remove the app files from
the search path when users exit the app.


  • If you want to share your app on MATLAB File Exchange, you must release it under a
    BSD license. In addition, there are restrictions on the use of binary files such as MEX-
    files, p-coded files, or DLLs.


Requirements:


  • The main file must be a function (not a script).

  • Because you invoke apps by clicking an icon in the apps gallery, the main function
    cannot have input arguments. (It can, however, take optional arguments.)

Free download pdf