How do I view the properties of an abstract class?

2 views (last 30 days)
For a class such as
classdef (Abstract) AbstractClassDemo
properties (Constant)
one = 1
two = 'two'
I should be using something like
which returns the error
No abstract methods or properties for class AbstractClassDemo or no class AbstractClassDemo.
To confirm to you that AbstractClassDemo is visible and accessible, I run
which returns
Abstract classes cannot be instantiated. Class 'AbstractClassDemo' is declared as Abstract.
What alternative options do I have? I can't find anything else I can do. Am I doing something wrong above? Should be simple right?

Accepted Answer

Steven Lord
Steven Lord on 12 May 2022
Call the properties function with the name of the Abstract class as input.
>> properties AbstractClassDemo
Properties for class AbstractClassDemo:
Alternately if you want additional information you could use either the ? operator or the meta.class.fromName function to create the meta.class object for the class. That object has an array of objects in its PropertyList property.
>> q = meta.class.fromName('AbstractClassDemo');
>> q = ?AbstractClassDemo;
>> propOne = q.PropertyList(1)
propOne =
property with properties:
Name: 'one'
Description: ''
DetailedDescription: ''
*snip the rest of the properties to keep this post short*

More Answers (0)


Find more on Class Introspection and Metadata 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!

Translated by