How do I view the properties of an abstract class?

A
Aaron Kaw · Nov 3, 2023 · 2K views
Question
For a class such as     classdef (Abstract) AbstractClassDemo properties (Constant) one = 1 two = 'two' end end I should be using something like meta.abstractDetails('AbstractClassDemo') 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     AbstractClassDemo 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?  
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 13, 2026

Call the properties function with the name of the Abstract class as input.

 

>> properties AbstractClassDemo
Properties for class AbstractClassDemo:

    one
    two

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 meta.property 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*

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!