How to programmatically get a list of all app properties in AppDesigner

23 views (last 30 days)
I'm writing a large app in appDesigner, and I want to create a list / text area that would display all of the app property fields. I can't find a way to programatically pull their names, does anyone know a way of doing this?
P.S. I'm on 2022b.

Accepted Answer

Abolfazl Chaman Motlagh
Abolfazl Chaman Motlagh on 15 Sep 2022
you can get all public properties with :
P = properties(app);
for all private and public properties you can use meta class properties function:
mc = ?appname
use the application name for appname (the name you saved .mlapp file, or name that appears after classdef at first line).
after that call for property list:
P = mc.PropertyList;
it give you a property array with the size of number of properties. and for eachone their information. for example run :
( i think the first index always is UIFigure)
a simple example for listing the names:
for i=1:numel(P)
Name{i} = P(i).Name;
  1 Comment
Vitek Stepien
Vitek Stepien on 16 Sep 2022
Thank you, the second method works great! I only neede the private properties, I was able to get the public ones on my own but not the private ones. I used the following to get and list in a ListBox only private, following your code suggestion:
mc = ?MyApp;
P = mc.PropertyList;
ii = 1;
for n = 1:numel(P)
if strcmp(P(n).GetAccess,'private')
Items{ii} = P(n).Name;
ii = ii+1;
app.ListofpropertiesListBox.Items = Items;

Sign in to comment.

More Answers (0)


Find more on Environment and Settings in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!