I have created the following directory structure:
ParentDirectory +mypack testClass.m Demos demoClass.m
I often like to put a folder called Demos in a package directory, where demonstrations using the class or classes in that package folder are placed. Often the demonstrations are scripts, but sometimes they are themsleves classes.
'ParentDirectory' is on my MATLAB path and I import the package:
import mypack.*
If I navigate to the Demos folder, and then try to instantiate an object of 'demoClass':
obj = demoClass
I see the error
??? Error using ==> demoClass The class 'demoClass' contains a parse error or cannot be found on MATLAB's search path, possibly shadowed by another file with the same name.
However, it works the second time.
Best Answer