MATLAB Creating Graphical User Interfaces

(ff) #1

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 any required input arguments. However, you can define optional input
    arguments. One way to define optional input arguments is by using varargin.


See Also


Related Examples



  • “Package Apps From the MATLAB Toolstrip” on page 20-5

  • “Modify Apps” on page 20-11

  • “Ways to Share Apps” on page 20-13


20 Packaging GUIs as Apps

Free download pdf