In MATLAB, is it possible to check if an object already exists before creating a new one?
问题 I'm trying to figure out how to ask the user whether they want to replace the previous object of the same class with the default object, or simply use the previous object, when calling the constructor. I'm looking for actions in both these cases: >>obj = Obj() 'obj' already exists. Replace it with default? (y/n): y %clear obj and call default constructor to create new obj >>obj = Obj() 'obj' already exists. Replace it with default? (y/n): n %cancel call of Obj() How would I do this? I've