Find files of specific class

6 visualizaciones (últimos 30 días)
Etienne Coetzee
Etienne Coetzee el 8 de Dic. de 2011
Hi Folks
I am building a user interface and have model objects of a specific class. The model name is defined as a property in the file. How can i find all the class files on the path and then populate a dropdown menu with the available model names in a popupmenu.
Thanks
Etienne

Respuestas (1)

Daniel Shub
Daniel Shub el 9 de Dic. de 2011
I don't think you can. You might be able to recursively check all the files and @ directories on the path for files with the first code line being something like:
classdef XXX < otherSuperClass & mySuperClass & anotherSuperClass
You also would then need to check for
classdef YYY < XXX
This of course does not mean that XXX or YYY is actually a valid class. There also could be files that look like:
str = 'classdef XXX < otherSuperClass & mySuperClass & anotherSuperClass'
In fact a function that searches for theses classes well likely have such a line. This will make it hard to do the parsing.
There may also be dynamic ways of defining the classes which will be even harder to catch.
A better way may be for the user to have to register the class so the GUI knows about it ...

Categorías

Más información sobre Software Development Tools en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by