MATLAB: How to get the name of the class object as a string

classclass objectmethodsstring

I am writing a method in a class which returns the name of a class object which was previously created using certain settings. So I need to know how do I extract only the name of the object created for those settings. Any help is appreciated!

Best Answer

One way I can think of is to use "evalin('base',...)" for your method to probe all the base workspace variables to check their properties (which is what I assume you mean by "settings"):
varlist = evalin('base','whos')
for i = 1:length(varlist)
if isa(varlist(i).class,myClassName)
% code to check property values or settings
end
end