I’m trying to list classes I created in some folder in my Matlab folder – using only their name (class name)
as an example, I have a class called ‘SimpleString’ – and I’m aiming to instantiate an object from that class, if all I know is that its name is ‘SimpleString’
So in realtime, I’d like to find out what classes are in a folder (done), then be able to instantiate any of those classes (my question)
Thanks
You can use
evalto instantiate the class using just the class name.However, if you’re simply iterating through all the m-files in a folder containing class definitions and grabbing the file names, you’ll only be able to invoke the default constructor using this method.