How to programmatically get a list of all app properties in AppDesigner
    14 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Vitek Stepien
      
 el 15 de Sept. de 2022
  
    
    
    
    
    Respondida: Joseph Reynolds
 el 4 de Abr. de 2025
            Hi,
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.
Thanks!
VS
0 comentarios
Respuesta aceptada
  Abolfazl Chaman Motlagh
      
 el 15 de Sept. de 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 :
P(1)
or
P(1).Name
( 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;
end
1 comentario
Más respuestas (1)
  Joseph Reynolds
 el 4 de Abr. de 2025
        To identify the properties that are created for just the GUI I used the P.Validation.Class.Name.
        name = 'appFileName';
        mc = eval(['?', name]);
        P = mc.PropertyList;
        np = length(P);
        flt = false(np,1);
        for n = 1:np
            flt(n) = contians({P.Validation.Class.Name}, 'matlab.ui');
        end
The Auto generated Properties have validation that start with 'matlab.ui'.
I use the filter to remove the auto generated properties.
P_used = P(~flt);
0 comentarios
Ver también
Categorías
				Más información sobre Downloads en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


