app designer lets you create professional-looking apps in MATLAB
without having to be a professional software developer app designer is the
recommended environment for building apps in MATLAB with app designer you can
easily design the user interface of the app and write the code that controls its
behavior you can also share your app by creating web apps with MATLAB compiler
note if you have existing apps built with guide you can download the
migration tool to assist you with moving them to app designer let's create a
simple app to study patient data the app will generate a scatterplot to see the
relationship between body weight and blood pressure
first we'll save our app apps are stored as a single file with the ml app
extension now in the center you layout your user interface components the
component library has a large number of components including buttons tabs and
trees in this example we first add the radio buttons for the gender here we can
delete the third button and rename the other buttons
we will also resize the components for uniformity now let's add a switch to
choose the type of blood pressure it's easy to align the components with the
provided hints
now let's add the plot button and finally add the axis component where
we will display the plot
we will edit the title and names of the x and y-axes
in the component browser names for the components are automatically generated
depending on labels you can also rename your components to easily identifiable
names
we can also customize the appearance of the components let's change the font of
the plot button to highlight it if we run our app now
we can see the switch button and axes however clicking on the plot button or
changing the gender selection has no effect to program the app behavior we
have to write the code you can quickly move between design view where we're
laying out our components and code view where we're programming the apps
behavior app designer automatically generates code to create all the user
interface components and sets their properties we can also add callbacks
that contain the code that gets executed when you interact with the apps
components in this example we'll add a callback for the plot button the grayed
out code is the code that is automatically created and managed by app
designer the white sections of the script are editable this structure of
the code makes it easy to understand and maintain first we need to load the
patient data here the if condition checks the value if the blood pressure
switch is on systolic and displays the data for the selected gender the same
thing is repeated for when the blood pressure type is diastolic we use the
syntax app dot component name to access the components from the code now we'll
add the code to create the scatter plot on the axis we can now run our patient
display app to visualize the relationship between weight and blood
pressure based on gender
now that we've created our app let's discuss how to share it you can package
apps with any supporting code or data as an MLM install file in this example
we'll just add the description of the app and package it
the ML app install file can be used by other users to install the app which can
be accessed in the apps tab in the MATLAB tool strip
using MATLAB compiler apps built with app designer can be deployed as
standalone desktop or web apps this allows you to share apps with others
even if they don't have MATLAB
now you can start building your own apps for more information about app designer
please see the links below