Any way to get the "current" class
Show older comments
Hi,
I am writing some object oriented code (with classdef), and it would be convenient for me to have a function like this:
meta.class.getCurrent()
Where it returns the metadata of the class in which it is called. In the event that the function is called from some other place (script or simple function) it should error
Is there a way to get that?
Thanks, Joan
1 Comment
Joan Puig
on 30 May 2013
Accepted Answer
More Answers (1)
Sean de Wolski
on 29 May 2013
Edited: Sean de Wolski
on 29 May 2013
Not sure I totally understand what you want. You have a class, C, and you pass an object, obj, of class C into some function, foo, via one of its methods or some other function and you want to be able to retreive the metadata of the obj or of class C? If the object is available, use:
?obj
If that is not the case, could you please clarify. You could have your function to a simple:
isa(obj,'C')
as well or instead...
1 Comment
Joan Puig
on 30 May 2013
Categories
Find more on Construct and Work with Object Arrays in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!